agent: comments for new anti-entropy functionality

This commit is contained in:
Ryan Uber 2015-01-14 23:09:42 -08:00
parent 72e750fb00
commit ced676ffc2

View file

@ -450,6 +450,9 @@ func (l *localState) syncService(id string) error {
WriteRequest: structs.WriteRequest{Token: l.config.ACLToken}, WriteRequest: structs.WriteRequest{Token: l.config.ACLToken},
} }
// If the service has associated checks that are out of sync,
// piggyback them on the service sync so they are part of the
// same transaction and are registered atomically.
var checks structs.HealthChecks var checks structs.HealthChecks
for _, check := range l.checks { for _, check := range l.checks {
if check.ServiceID == id { if check.ServiceID == id {
@ -459,6 +462,7 @@ func (l *localState) syncService(id string) error {
} }
} }
// Backwards-compatibility for Consul < 0.5
if len(checks) == 1 { if len(checks) == 1 {
req.Check = checks[0] req.Check = checks[0]
} else { } else {