mirror of https://github.com/status-im/consul.git
Ensure that Proxies ARE always cleaned up, event with DeregisterCriticalServiceAfter (#4649)
This fixes https://github.com/hashicorp/consul/issues/4648
This commit is contained in:
parent
b66763eb33
commit
2fe728c7bd
|
@ -1818,6 +1818,15 @@ func (a *Agent) RemoveService(serviceID string, persist bool) error {
|
|||
}
|
||||
}
|
||||
|
||||
// Remove the associated managed proxy if it exists
|
||||
for proxyID, p := range a.State.Proxies() {
|
||||
if p.Proxy.TargetServiceID == serviceID {
|
||||
if err := a.RemoveProxy(proxyID, true); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
a.logger.Printf("[DEBUG] agent: removed service %q", serviceID)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -682,15 +682,6 @@ func (s *HTTPServer) AgentDeregisterService(resp http.ResponseWriter, req *http.
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// Remove the associated managed proxy if it exists
|
||||
for proxyID, p := range s.agent.State.Proxies() {
|
||||
if p.Proxy.TargetServiceID == serviceID {
|
||||
if err := s.agent.RemoveProxy(proxyID, true); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s.syncChanges()
|
||||
return nil, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue