mirror of https://github.com/status-im/consul.git
agent: anti-entropy sync services/checks if they don't exist in the catalog
This commit is contained in:
parent
e5797d9a86
commit
a60f4adf95
|
@ -316,6 +316,13 @@ func (l *localState) setSyncState() error {
|
|||
l.Lock()
|
||||
defer l.Unlock()
|
||||
|
||||
for id, _ := range l.services {
|
||||
// If the local service doesn't exist remotely, then sync it
|
||||
if _, ok := services.Services[id]; !ok {
|
||||
l.serviceStatus[id] = syncStatus{inSync: false}
|
||||
}
|
||||
}
|
||||
|
||||
if services != nil {
|
||||
for id, service := range services.Services {
|
||||
// If we don't have the service locally, deregister it
|
||||
|
@ -331,6 +338,16 @@ func (l *localState) setSyncState() error {
|
|||
}
|
||||
}
|
||||
|
||||
for id, _ := range l.checks {
|
||||
// Sync any check which doesn't exist on the remote side
|
||||
for _, check := range checks {
|
||||
if check.CheckID == id {
|
||||
continue
|
||||
}
|
||||
l.checkStatus[id] = syncStatus{inSync: false}
|
||||
}
|
||||
}
|
||||
|
||||
for _, check := range checks {
|
||||
// If we don't have the check locally, deregister it
|
||||
id := check.CheckID
|
||||
|
|
Loading…
Reference in New Issue