Merge pull request #884 from artushin/check-update-stagger

Check update stagger
This commit is contained in:
Armon Dadgar 2015-05-04 15:05:08 -07:00
commit 7aadd43084
2 changed files with 3 additions and 2 deletions

View File

@ -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}

View File

@ -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")