mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Fix HA not resuming after being responsible again
This commit is contained in:
parent
ca217ebfe0
commit
449ab7d8cb
1 changed files with 6 additions and 2 deletions
8
ha/ha.go
8
ha/ha.go
|
|
@ -137,6 +137,7 @@ func (h *HA) Run(chEnv chan *Environment) {
|
|||
} else {
|
||||
haLogger.Info("Other instance is active.")
|
||||
h.isActive = false
|
||||
h.lastEventId = "0-0"
|
||||
}
|
||||
|
||||
timerHA := time.NewTimer(time.Second * 15)
|
||||
|
|
@ -187,6 +188,7 @@ func (h *HA) Run(chEnv chan *Environment) {
|
|||
case <-timerHA.C:
|
||||
haLogger.Info("Icinga 2 sent no heartbeat for 15 seconds, pronouncing dead.")
|
||||
h.isActive = false
|
||||
h.lastEventId = "0-0"
|
||||
h.notifyNotificationListener("*", Notify_StopSync)
|
||||
}
|
||||
}
|
||||
|
|
@ -208,10 +210,12 @@ func (h *HA) runEventListener() {
|
|||
return
|
||||
}
|
||||
|
||||
result := h.super.Rdbw.XRead(&redis.XReadArgs{Streams: []string{"icinga:dump", h.lastEventId}})
|
||||
result := h.super.Rdbw.XRead(&redis.XReadArgs{Block: -1, Streams: []string{"icinga:dump", h.lastEventId}})
|
||||
streams, err := result.Result()
|
||||
if err != nil {
|
||||
h.super.ChErr <- err
|
||||
if err.Error() != "redis: nil" {
|
||||
h.super.ChErr <- err
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue