Skip to content

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

Merged
merged 8 commits into from
Aug 25, 2023

Conversation

comandeo
Copy link

No description provided.

@comandeo comandeo marked this pull request as ready for review August 25, 2023 09:29
@comandeo comandeo requested a review from jamis August 25, 2023 09:30
Copy link
Contributor

@jamis jamis left a 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)
Copy link
Contributor

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.

@comandeo comandeo changed the title DRIVERS-1571 Retry reads/writes on another mongos RUBY-2748 Retry reads/writes on another mongos Aug 25, 2023
@comandeo comandeo merged commit b03052a into mongodb:master Aug 25, 2023
@comandeo comandeo deleted the poc-drivers-1571 branch August 25, 2023 18:29
comandeo pushed a commit to comandeo/mongo-ruby-driver that referenced this pull request Jan 24, 2024
* First implementation attempt

* Adjust spec requirement

* Improve specs

* Add write spec

* Add documenting comments

* Use proper error codes in prose tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants