-
Notifications
You must be signed in to change notification settings - Fork 4.6k
clientconn: Wait for health check when closing the transport #8783
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8783 +/- ##
==========================================
- Coverage 83.33% 83.29% -0.04%
==========================================
Files 418 418
Lines 32910 32921 +11
==========================================
- Hits 27424 27421 -3
- Misses 4088 4095 +7
- Partials 1398 1405 +7
🚀 New features to boost your workflow:
|
clientconn.go
Outdated
| func (ac *addrConn) createTransport(ctx context.Context, addr resolver.Address, copts transport.ConnectOptions, connectDeadline time.Time) error { | ||
| addr.ServerName = ac.cc.getServerName(addr) | ||
|
|
||
| var healthCheckDone <-chan struct{} |
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.
I think healthCheckCh and healthCheckDoneCh might be slightly better variable names to indicate that these are channels.
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.
Done.
|
|
||
| ac.mu.Lock() | ||
| defer ac.mu.Unlock() | ||
| defer func() { |
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.
Can you add a small note stating where the healthCheckComplete is set and why do we wait on healthCheckComplete instead of healthCheckDone.
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.
Added some comments. Hope they're helpful.
The health check goroutine could outlive a call to ClientConn.close(). Add a done channel that will be waited on when closing the transport. RELEASE NOTES: - Closing a client connection will now block until the health check goroutine completes. Signed-off-by: Tom Wieczorek <twieczorek@mirantis.com>
bfd0214 to
599fb48
Compare
The health check goroutine could outlive a call to
ClientConn.close(). Add a done channel that will be waited on when closing the transport.See:
RELEASE NOTES: