Fix stats fetcher healthcheck RPCs not being independent

This commit is contained in:
Kyle Havlovitz 2018-08-14 14:23:52 -07:00
parent 1afcabb0a2
commit aa19559cc7
No known key found for this signature in database
GPG Key ID: 8A5E6B173056AD6C
1 changed files with 8 additions and 0 deletions

View File

@ -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