diff --git a/command/agent/local.go b/command/agent/local.go index f85d6671ad..0643776eab 100644 --- a/command/agent/local.go +++ b/command/agent/local.go @@ -208,7 +208,8 @@ func (l *localState) UpdateCheck(checkID, status, output string) { if l.config.CheckUpdateInterval > 0 && check.Status == status { check.Output = output if _, ok := l.deferCheck[checkID]; !ok { - deferSync := time.AfterFunc(l.config.CheckUpdateInterval, func() { + intv := time.Duration(uint64(l.config.CheckUpdateInterval)/2) + randomStagger(l.config.CheckUpdateInterval) + deferSync := time.AfterFunc(intv, func() { l.Lock() if _, ok := l.checkStatus[checkID]; ok { l.checkStatus[checkID] = syncStatus{inSync: false} diff --git a/command/agent/local_test.go b/command/agent/local_test.go index 480da00cd7..f952190980 100644 --- a/command/agent/local_test.go +++ b/command/agent/local_test.go @@ -601,7 +601,7 @@ func TestAgentAntiEntropy_Check_DeferSync(t *testing.T) { }) } -func TestAgentAntiEntory_deleteService_fails(t *testing.T) { +func TestAgentAntiEntropy_deleteService_fails(t *testing.T) { l := new(localState) if err := l.deleteService(""); err == nil { t.Fatalf("should have failed")