From a88c36bdc13563af5f4e1289ea36f3c7c9d35262 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Mon, 9 Jun 2014 16:00:25 -0700 Subject: [PATCH] agent: Prevent anti-entropy from doing early sync of check output --- command/agent/local.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/command/agent/local.go b/command/agent/local.go index d1457c7e5b..2f56b161c7 100644 --- a/command/agent/local.go +++ b/command/agent/local.go @@ -202,8 +202,11 @@ func (l *localState) UpdateCheck(checkID, status, output string) { if status.deferSync == nil && status.inSync { deferSync := time.AfterFunc(l.config.CheckUpdateInterval, func() { l.Lock() - l.checkStatus[checkID] = syncStatus{inSync: false} - l.changeMade() + status, ok := l.checkStatus[checkID] + if ok && status.inSync { + l.checkStatus[checkID] = syncStatus{inSync: false} + l.changeMade() + } l.Unlock() }) l.checkStatus[checkID] = syncStatus{inSync: true, deferSync: deferSync} @@ -339,7 +342,18 @@ func (l *localState) setSyncState() error { } // If our definition is different, we need to update it - equal := reflect.DeepEqual(existing, check) + var equal bool + if l.config.CheckUpdateInterval == 0 { + equal = reflect.DeepEqual(existing, check) + } else { + eCopy := new(structs.HealthCheck) + *eCopy = *existing + eCopy.Output = "" + check.Output = "" + equal = reflect.DeepEqual(eCopy, check) + } + + // Update the status l.checkStatus[id] = syncStatus{inSync: equal} } return nil