From 0f8837824ec2ec9eb29b4b6df205c8c331a3b3f6 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 845792de2f..dd414bc977 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