retrieval/discovery: refresh services in Consul to recover from missing events.
This commit is contained in:
parent
4319b06dd2
commit
23862c92c4
|
@ -180,8 +180,8 @@ func (cd *ConsulDiscovery) watchServices(update chan<- *consulService) {
|
|||
for {
|
||||
catalog := cd.client.Catalog()
|
||||
srvs, meta, err := catalog.Services(&consul.QueryOptions{
|
||||
RequireConsistent: false,
|
||||
WaitIndex: lastIndex,
|
||||
WaitIndex: lastIndex,
|
||||
WaitTime: consulWatchTimeout,
|
||||
})
|
||||
if err != nil {
|
||||
log.Errorf("Error refreshing service list: %s", err)
|
||||
|
@ -197,6 +197,7 @@ func (cd *ConsulDiscovery) watchServices(update chan<- *consulService) {
|
|||
cd.mu.Lock()
|
||||
select {
|
||||
case <-cd.srvsDone:
|
||||
cd.mu.Unlock()
|
||||
return
|
||||
default:
|
||||
// Continue.
|
||||
|
@ -272,9 +273,11 @@ func (cd *ConsulDiscovery) watchService(srv *consulService, ch chan<- *config.Ta
|
|||
ConsulTagsLabel: clientmodel.LabelValue(tags),
|
||||
})
|
||||
}
|
||||
|
||||
cd.mu.Lock()
|
||||
select {
|
||||
case <-srv.done:
|
||||
cd.mu.Unlock()
|
||||
return
|
||||
default:
|
||||
// Continue.
|
||||
|
|
Loading…
Reference in New Issue