mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
HA: only read new hearbeats from Redis
Selecting any heartbeat from the last 15 seconds from Redis makes little sense, just wait for new ones. If Icinga 2 just stopped, there is no point in becoming active for just a few seconds, otherwise the next heartbeat will arrive in a second anyways.
This commit is contained in:
parent
4374eec849
commit
9d23bbec2e
1 changed files with 1 additions and 3 deletions
|
|
@ -5,12 +5,10 @@ package ha
|
|||
import (
|
||||
"crypto/sha1"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/Icinga/icingadb/connection"
|
||||
"github.com/Icinga/icingadb/utils"
|
||||
"github.com/go-redis/redis/v7"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Environment struct {
|
||||
|
|
@ -43,7 +41,7 @@ func IcingaHeartbeatListener(rdb *connection.RDBWrapper, chEnv chan *Environment
|
|||
log.Info("Starting heartbeat listener")
|
||||
|
||||
xReadArgs := redis.XReadArgs{
|
||||
Streams: []string{"icinga:stats", fmt.Sprintf("%d-0", utils.TimeToMillisecs(time.Now().Add(-15*time.Second)))},
|
||||
Streams: []string{"icinga:stats", "$"},
|
||||
Count: 1,
|
||||
Block: 0,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue