client: don't retry fingerprinting on shutdown

At shutdown, driver manager context expires and the fingerprinting
channel closes.  Thus it is undeterministic which clause of The select
statement gets executed, and we may keep retrying until the
`i.ctx.Done()` block is executed.

Here, we check always check ctx expiration before retrying again.
This commit is contained in:
Mahmood Ali
2019-10-21 08:54:11 -04:00
parent 75acbccf8e
commit 0cfea7d978

View File

@@ -307,6 +307,12 @@ func (i *instanceManager) fingerprint() {
continue
}
// avoid fingerprinting again if ctx and fpChan both close
if i.ctx.Err() != nil {
cancel()
return
}
// if the channel is closed attempt to open a new one
newFpChan, newCancel, err := i.dispenseFingerprintCh()
if err != nil {