mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Merge pull request #97 from Icinga/bugfix/do-not-use-seconds
HA: Do not use seconds in responsibility check
This commit is contained in:
commit
fc72e68fd4
2 changed files with 2 additions and 2 deletions
2
ha/ha.go
2
ha/ha.go
|
|
@ -214,7 +214,7 @@ func (h *HA) checkResponsibility(env *Environment) {
|
|||
return
|
||||
}
|
||||
|
||||
if time.Now().Unix()-beat > 15*1000 {
|
||||
if utils.TimeToMillisecs(time.Now())-beat > 15*1000 {
|
||||
h.logger.Info("Taking over.")
|
||||
|
||||
// This means there was no instance row match, insert
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ func TestHA_checkResponsibility(t *testing.T) {
|
|||
_, err = ha.super.Dbw.SqlExec(
|
||||
mysqlObservers.insertIntoIcingadbInstance,
|
||||
"INSERT INTO icingadb_instance(id, environment_id, heartbeat, responsible, icinga2_version, icinga2_start_time) VALUES (?, ?, ?, 'y', '', 0)",
|
||||
ha.uid[:], ha.super.EnvId, time.Now().Unix(),
|
||||
ha.uid[:], ha.super.EnvId, utils.TimeToMillisecs(time.Now()),
|
||||
)
|
||||
|
||||
ha.isActive = false
|
||||
|
|
|
|||
Loading…
Reference in a new issue