Merge pull request #884 from artushin/check-update-stagger
Check update stagger
This commit is contained in:
commit
7aadd43084
|
@ -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}
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue