-
Notifications
You must be signed in to change notification settings - Fork 4.5k
balancer: Make ExitIdle compulsory for Balancers #8367
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 ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8367 +/- ##
==========================================
+ Coverage 82.17% 82.34% +0.16%
==========================================
Files 419 419
Lines 42034 42041 +7
==========================================
+ Hits 34541 34618 +77
+ Misses 6027 5969 -58
+ Partials 1466 1454 -12
🚀 New features to boost your workflow:
|
c91eab8
to
dbd5915
Compare
dbd5915
to
111c588
Compare
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.
Looks good, just one thing I noticed in a few places that could possibly eliminate some code.
@@ -102,6 +102,10 @@ type fakePetiole struct { | |||
bOpts balancer.BuildOptions | |||
} | |||
|
|||
func (fp *fakePetiole) ExitIdle() { | |||
fp.Balancer.ExitIdle() |
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 isn't necessary, is it? Balancer
is embedded so this should happen automatically?
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.
You're right, removed it. I was working on top of the previous PR that added ExitIdle implementations but didn't add the method to the Balancer
interface. This was an artifact of the that.
if ib, ok := b.Balancer.(balancer.ExitIdler); ok { | ||
ib.ExitIdle() | ||
} | ||
b.Balancer.ExitIdle() |
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.
As above? And more below.
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.
Removed. Fixed throughout.
@@ -1034,7 +1034,7 @@ func (s) TestSubConn_RegisterHealthListener(t *testing.T) { | |||
return bd.Data.(balancer.Balancer).UpdateClientConnState(ccs) | |||
}, | |||
ExitIdle: func(bd *stub.BalancerData) { | |||
bd.Data.(balancer.ExitIdler).ExitIdle() | |||
bd.Data.(balancer.Balancer).ExitIdle() |
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 seems like a very common pattern. I wonder if it makes sense for the stub balancer stuff to support an embedded child balancer by default? (Not in this PR for sure.)
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.
Opened an issue: #8371
Fixes: #8345
RELEASE NOTES:
ExitIdle
method toBalancer
. Earlier implementing this method was optional.