-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Changes from 5 commits
025055e
aca03a5
98ebf34
111c588
fb056d6
a08fdcc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1593,9 +1593,7 @@ func (b *stateStoringBalancer) Close() { | |
} | ||
|
||
func (b *stateStoringBalancer) ExitIdle() { | ||
if ib, ok := b.Balancer.(balancer.ExitIdler); ok { | ||
ib.ExitIdle() | ||
} | ||
b.Balancer.ExitIdle() | ||
|
||
} | ||
|
||
type stateStoringBalancerBuilder struct { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,3 +60,6 @@ | |
|
||
// Close is a no-op. | ||
func (b *bal) Close() {} | ||
|
||
// ExitIdle is a no-op. | ||
func (b *bal) ExitIdle() {} | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Opened an issue: #8371 |
||
}, | ||
} | ||
|
||
|
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.