From f5634a24e8beae3415e845000cd43d0c3dd5721f Mon Sep 17 00:00:00 2001 From: Freddy Date: Fri, 12 Jul 2019 08:23:28 -0600 Subject: [PATCH] Clean up StatsFetcher work when context is exceeded (#6086) --- agent/consul/stats_fetcher.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/agent/consul/stats_fetcher.go b/agent/consul/stats_fetcher.go index 845792de2..dd414bc97 100644 --- a/agent/consul/stats_fetcher.go +++ b/agent/consul/stats_fetcher.go @@ -107,6 +107,10 @@ func (f *StatsFetcher) Fetch(ctx context.Context, members []serf.Member) map[str case <-ctx.Done(): f.logger.Printf("[WARN] consul: error getting server health from %q: %v", workItem.server.Name, ctx.Err()) + + f.inflightLock.Lock() + delete(f.inflight, workItem.server.ID) + f.inflightLock.Unlock() } } return replies