rpcclient: Shutdown breaks reconnect sleep.
When a shutdown is requested, the sleep should not continue in (*Client).wsReconnectHandler. Instead, use a select with the shutdown channel and a time.After.
This commit is contained in:
parent
9f23126c9a
commit
02a58def2f
@ -716,9 +716,13 @@ out:
|
||||
if scaledDuration > time.Minute {
|
||||
scaledDuration = time.Minute
|
||||
}
|
||||
log.Infof("Retrying connection to %s in "+
|
||||
"%s", c.config.Host, scaledDuration)
|
||||
time.Sleep(scaledDuration)
|
||||
log.Infof("Retrying connection to %s in %s",
|
||||
c.config.Host, scaledDuration)
|
||||
select {
|
||||
case <-c.shutdown:
|
||||
break out
|
||||
case <-time.After(scaledDuration):
|
||||
}
|
||||
continue reconnect
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user