add a shortcut logic
This commit is contained in:
@ -238,6 +238,9 @@ func (cc *ClientConn) WaitForStateChange(timeout time.Duration, sourceState Conn
|
|||||||
}
|
}
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
expired := timeout <= time.Since(start)
|
expired := timeout <= time.Since(start)
|
||||||
|
if expired {
|
||||||
|
return false
|
||||||
|
}
|
||||||
go func() {
|
go func() {
|
||||||
select {
|
select {
|
||||||
case <-time.After(timeout-time.Since(start)):
|
case <-time.After(timeout-time.Since(start)):
|
||||||
|
Reference in New Issue
Block a user