-
Notifications
You must be signed in to change notification settings - Fork 353
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
Refactor load balancer, decouple it from fadeIn #2381
Conversation
68acf23
to
d093de2
Compare
d093de2
to
5a95a41
Compare
Added some code trying to avoid races. |
5a95a41
to
c131ef0
Compare
Addressed some of Sandor's comments. However, still searching for the good place for |
@RomanZavodskikh I think the only place to start a goroutine is the startReceivingUpdates() func in routing.go. |
c131ef0
to
0fe28a2
Compare
Decided not to close |
0fe28a2
to
4d852b4
Compare
bd81dfb
to
c3edd2b
Compare
Made |
Moved |
ddcc4b5
to
c41548a
Compare
The code looks good to me some worries, but it's more feeling than anything else, so data will convince me. |
99e5a0b
to
c743aa7
Compare
b80d7be
to
652fe65
Compare
r.mx.Lock() | ||
defer r.mx.Unlock() | ||
|
||
if len(r.HealthyEndpoints) == 0 { |
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.
Let's initialize in constructor/updateHealthyEndpoints.
loadbalancer/algorithm.go
Outdated
} | ||
r.oldEpsLen = int64(len(endpoints)) | ||
r.index = (r.index + 1) % int64(len(endpoints)) |
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.
No need to store r.index here.
loadbalancer/fadein_test.go
Outdated
updateCh := make(chan time.Time) | ||
defer close(updateCh) | ||
r := routing.New(routing.Options{UpdateGoodEndpointsChan: updateCh}) | ||
r.SetRoute(ctx.Route) |
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.
Need to create dataclient, preprocessors, postprocessors, etc...
} | ||
|
||
ri.mx.Lock() | ||
ri.HealthyEndpoints = newHealthyEndpoints |
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.
What happens during routing table update?
Signed-off-by: Roman Zavodskikh <roman.zavodskikh@zalando.de>
Signed-off-by: Roman Zavodskikh <roman.zavodskikh@zalando.de>
Signed-off-by: Roman Zavodskikh <roman.zavodskikh@zalando.de>
Updates #2346 Signed-off-by: Roman Zavodskikh <roman.zavodskikh@zalando.de>
Signed-off-by: Roman Zavodskikh <roman.zavodskikh@zalando.de>
652fe65
to
8d8ad81
Compare
Updates #2346