Skip to content

Refactor to use Timeout for server selection #1202

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 2 commits into from
Sep 27, 2023

Conversation

katcharov
Copy link
Collaborator

JAVA-5175

This uses Timeout for timeout logic, and ensures that settings are obtained from one location, for consistency with how settings will be obtained from the recently-merged TimeoutSettings (though, this is not used, as it is not yet propagated into OperationContext).

@katcharov katcharov requested a review from rozza September 22, 2023 21:13
} else {
// the timeout will track this remaining time
//noinspection ResultOfMethodCallIgnored
latch.await(this.remaining(NANOSECONDS), NANOSECONDS);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The result of the latch needs to be inspected - as if it returns false it awaited the time limit but wasn't counted down.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, the 3 usages, all in BaseCluster, that were refactored into this method did not inspect the result. (Perhaps they should have inspected the result, but I could not readily see the error.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - nothing to do here.

@rozza
Copy link
Member

rozza commented Sep 26, 2023

Looking good - much easier to read, couple of comments / questions.

@katcharov katcharov requested a review from rozza September 26, 2023 17:15
Copy link
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@katcharov katcharov merged commit 158b69c into mongodb:CSOT Sep 27, 2023
@katcharov katcharov deleted the JAVA-5175 branch September 27, 2023 16:20
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.

2 participants