Merge pull request #95 from Icinga/bugfix/wait-heartbeat

Wait for a new heartbeat
This commit is contained in:
Noah Hilverling 2019-12-11 18:11:41 +01:00 committed by GitHub
commit 57972cc002
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,9 +6,12 @@ import (
"crypto/sha1"
"encoding/hex"
"encoding/json"
"fmt"
"github.com/Icinga/icingadb/connection"
"github.com/Icinga/icingadb/utils"
"github.com/go-redis/redis"
log "github.com/sirupsen/logrus"
"time"
)
type Environment struct {
@ -35,7 +38,7 @@ func IcingaHeartbeatListener(rdb *connection.RDBWrapper, chEnv chan *Environment
log.Info("Starting heartbeat listener")
xReadArgs := redis.XReadArgs{
Streams: []string{"icinga:stats", "0-0"},
Streams: []string{"icinga:stats", fmt.Sprintf("%d-0", utils.TimeToMillisecs(time.Now().Add(-15*time.Second)))},
Count: 1,
Block: 0,
}