Skip to content

refactor(NODE-5914): topology.selectServer to async-await #4020

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 44 commits into from
Mar 15, 2024

Conversation

W-A-James
Copy link
Contributor

@W-A-James W-A-James commented Mar 5, 2024

Description

What is changing?

  • Refactored Topology.selectServer to async/await syntax
  • Refactored Topology.connect to async/await syntax and add connection lock
  • Refactored all references to Topology.selectServer in the driver including
Is there new documentation needed for these changes?

No

What is the motivation for this change?

NODE-5914

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@W-A-James W-A-James force-pushed the NODE-5914/refactor-selectServer branch from 03a009a to 7db2f7f Compare March 8, 2024 15:39
@W-A-James W-A-James changed the base branch from main to NODE-5915/refactor-topology-close-to-be-synchronous March 8, 2024 15:39
@W-A-James W-A-James force-pushed the NODE-5915/refactor-topology-close-to-be-synchronous branch from c533616 to b9ee91c Compare March 8, 2024 21:08
Base automatically changed from NODE-5915/refactor-topology-close-to-be-synchronous to main March 11, 2024 17:35
@W-A-James W-A-James force-pushed the NODE-5914/refactor-selectServer branch from 497a29e to e033bd5 Compare March 11, 2024 18:00
@W-A-James W-A-James requested a review from nbbeeken March 13, 2024 16:48
@nbbeeken nbbeeken changed the title refactor(NODE-5914): refactor Topology.selectServer to async-await refactor(NODE-5914): topology.selectServer to async-await Mar 13, 2024
@W-A-James W-A-James requested a review from nbbeeken March 14, 2024 18:55
@@ -883,7 +877,7 @@ function updateServers(topology: Topology, incomingServerDescription?: ServerDes
}
}

function drainWaitQueue(queue: List<ServerSelectionRequest>, err?: MongoDriverError) {
function drainWaitQueue(queue: List<ServerSelectionRequest>, drainError: MongoDriverError) {
Copy link
Contributor

Choose a reason for hiding this comment

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

🔥 I always appreciate drive-by improvement of variable names, thanks for improving this one!

lack of attention to variable names leads to death of readability by a thousand cuts 🔪

}
return;
} catch (err) {
// are we expecting an error?
Copy link
Contributor

Choose a reason for hiding this comment

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

tbh I thought this was intended to be a question for the reviewers 😅

I don't feel strongly but maybe making it a statement instead of a question would be a little more clear

Copy link
Contributor

@nbbeeken nbbeeken left a comment

Choose a reason for hiding this comment

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

just a formatting lint 🎉

@W-A-James W-A-James requested a review from nbbeeken March 15, 2024 14:49
@nbbeeken nbbeeken merged commit aec8416 into main Mar 15, 2024
@nbbeeken nbbeeken deleted the NODE-5914/refactor-selectServer branch March 15, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Primary Review In Review with primary reviewer, not yet ready for team's eyes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants