agent: Prevent anti-entropy from doing early sync of check output

pull/205/head
Armon Dadgar 11 years ago
parent cca2f5a545
commit a88c36bdc1

@ -202,8 +202,11 @@ func (l *localState) UpdateCheck(checkID, status, output string) {
if status.deferSync == nil && status.inSync { if status.deferSync == nil && status.inSync {
deferSync := time.AfterFunc(l.config.CheckUpdateInterval, func() { deferSync := time.AfterFunc(l.config.CheckUpdateInterval, func() {
l.Lock() l.Lock()
l.checkStatus[checkID] = syncStatus{inSync: false} status, ok := l.checkStatus[checkID]
l.changeMade() if ok && status.inSync {
l.checkStatus[checkID] = syncStatus{inSync: false}
l.changeMade()
}
l.Unlock() l.Unlock()
}) })
l.checkStatus[checkID] = syncStatus{inSync: true, deferSync: deferSync} 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 // 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} l.checkStatus[id] = syncStatus{inSync: equal}
} }
return nil return nil

Loading…
Cancel
Save