-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: update client state subscriber test to be not flaky and more stressful about rapid updates #6512
Conversation
…ressful about rapid updates
clientconn.go
Outdated
@@ -1234,6 +1230,7 @@ func (cc *ClientConn) ResetConnectBackoff() { | |||
|
|||
// Close tears down the ClientConn and all underlying connections. | |||
func (cc *ClientConn) Close() error { | |||
defer func() { <-cc.csMgr.pubSub.Done() }() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now executed outside of cc.mu
. Was that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. cc.cancel()
needs to happen or else pubSub.Done()
will never close. And csMgr
isn't protected by cc.mu
so it should be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: Maybe a single defer
instead of two? Even when we know that deferred funcs are executed LIFO, this is easier to read than having two defers I feel.
defer func() {
cc.cancel()
<-cc.csMgr.pubSub.Done()
}()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM - done
clientconn.go
Outdated
@@ -1234,6 +1230,7 @@ func (cc *ClientConn) ResetConnectBackoff() { | |||
|
|||
// Close tears down the ClientConn and all underlying connections. | |||
func (cc *ClientConn) Close() error { | |||
defer func() { <-cc.csMgr.pubSub.Done() }() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: Maybe a single defer
instead of two? Even when we know that deferred funcs are executed LIFO, this is easier to read than having two defers I feel.
defer func() {
cc.cancel()
<-cc.csMgr.pubSub.Done()
}()
RELEASE NOTES: none