-
Notifications
You must be signed in to change notification settings - Fork 534
RUBY-2748 Retry reads/writes on another mongos #2717
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
Conversation
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 looks great! Very easy to follow, and the tests are set up well, too. 👍 👍
def select_server(cluster, server_selector, session) | ||
server_selector.select_server(cluster, nil, session) | ||
def select_server(cluster, server_selector, session, failed_server = nil) | ||
server_selector.select_server(cluster, nil, session, deprioritized: [failed_server].compact) |
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.
If you're just wanting to squeeze a possible nil out of a single element array, another idiom I find a little simpler is to use the Array
initializer:
> Array(nil)
[]
> Array(5)
[5]
> Array([5])
[5]
Ultimately it's personal preference, though -- [failed_server].compact
is fine, too.
* First implementation attempt * Adjust spec requirement * Improve specs * Add write spec * Add documenting comments * Use proper error codes in prose tests
No description provided.