Clean up StatsFetcher work when context is exceeded (#6086)

This commit is contained in:
Freddy 2019-07-12 08:23:28 -06:00 committed by GitHub
parent de23af071a
commit 0f8837824e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -107,6 +107,10 @@ func (f *StatsFetcher) Fetch(ctx context.Context, members []serf.Member) map[str
case <-ctx.Done(): case <-ctx.Done():
f.logger.Printf("[WARN] consul: error getting server health from %q: %v", f.logger.Printf("[WARN] consul: error getting server health from %q: %v",
workItem.server.Name, ctx.Err()) workItem.server.Name, ctx.Err())
f.inflightLock.Lock()
delete(f.inflight, workItem.server.ID)
f.inflightLock.Unlock()
} }
} }
return replies return replies