From aa19559cc722592605c444e914450b234ba10f82 Mon Sep 17 00:00:00 2001 From: Kyle Havlovitz Date: Tue, 14 Aug 2018 14:23:52 -0700 Subject: [PATCH] Fix stats fetcher healthcheck RPCs not being independent --- agent/consul/stats_fetcher.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/agent/consul/stats_fetcher.go b/agent/consul/stats_fetcher.go index 51a03e158..845792de2 100644 --- a/agent/consul/stats_fetcher.go +++ b/agent/consul/stats_fetcher.go @@ -92,6 +92,14 @@ func (f *StatsFetcher) Fetch(ctx context.Context, members []serf.Member) map[str // canceled. replies := make(map[string]*autopilot.ServerStats) for _, workItem := range work { + // Drain the reply first if there is one. + select { + case reply := <-workItem.replyCh: + replies[workItem.server.ID] = reply + continue + default: + } + select { case reply := <-workItem.replyCh: replies[workItem.server.ID] = reply