-
Notifications
You must be signed in to change notification settings - Fork 22
Add Random Load Balancing Strategy #590
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
Add Random Load Balancing Strategy #590
Conversation
- Introduced `RANDOM` strategy in `constants.go` and `loadbalancer.go`. - Updated `gatewayd.yaml` to use the new `RANDOM` strategy as an option.
mostafa
left a comment
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.
LGTM! 🙏
Thanks for your contribution!
|
|
||
| proxy, err := random.NextProxy() | ||
|
|
||
| assert.Nil(t, err) |
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.
| assert.Nil(t, err) | |
| assert.NoError(t, err) |
| random := NewRandom(server) | ||
|
|
||
| assert.NotNil(t, random) | ||
| assert.Equal(t, len(proxies), len(random.proxies)) |
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.
| assert.Equal(t, len(proxies), len(random.proxies)) | |
| assert.Len(t, random.proxies, len(proxies)) |
|
|
||
| proxy, err := random.NextProxy() | ||
|
|
||
| assert.Nil(t, proxy) |
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.
| assert.Nil(t, proxy) | |
| assert.Nil(t, proxy) | |
| require.NotNil(t, err) |
Otherwise next line will panic when there is no error
I'm unsure if the gerr implents Error()
If so, I would use
| assert.Nil(t, proxy) | |
| assert.Nil(t, proxy) | |
| require.Error(t, err) |
| proxy1, _ := random.NextProxy() | ||
| proxy2, _ := random.NextProxy() |
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.
| proxy1, _ := random.NextProxy() | |
| proxy2, _ := random.NextProxy() | |
| proxy1, err := random.NextProxy() | |
| require.NoError(t, err) | |
| proxy2, err := random.NextProxy() | |
| require.NoError(t, err) |
Ticket(s)
#398
Description
This PR introduces a new load balancing strategy, RANDOM
The key changes include
Related PRs
Development Checklist
make gen-docscommand.Legal Checklist