Skip to content
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

refactor(NODE-4637): clean up async interval #3411

Merged
merged 10 commits into from Sep 16, 2022

Conversation

baileympearson
Copy link
Contributor

@baileympearson baileympearson commented Sep 14, 2022

Description

What is changing?

This PR does a bit of cleanup on the async interval using in SDAM monitoring. Specifically it

  • Moves the async interval into the monitor.ts file from the utils
  • Move the associated unit tests
  • Converts monitor.test.js to Typescript. This was necessary because the existing interval tests were in Typescript, so I could either convert them to JS or convert monitor.test.js to TS. I chose the latter.
  • converts the makeInterruptibleAsyncInterval factory function into a class
  • renames some variables to more closely align with their actual purpose and renames the interval SDAMMonitorInterval (name can be workshopped).

To aid in review, moved the interval to monitor.ts (and the associated tests) in the first commit, and then tried to be granular with the changes from then on. My intention was to put all the code reorganization changes in to the first commit, so the actual code changes that I made can be easily viewed in a diff.

Is there new documentation needed for these changes?

No.

What is the motivation for this change?

General code cleanup and better code organization.

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>
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@baileympearson baileympearson changed the title refactor: move makeInterruptibleAsyncInterval to monitor.ts refactor(NODE-4637): clean up async interval Sep 14, 2022
@baileympearson baileympearson marked this pull request as ready for review September 14, 2022 19:58
@@ -386,7 +386,9 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The missing overloads in this file were revealed when I converted the monitor tests to TS. I'm happy to revert these changes and cast in the test file instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's internal I think it's fine.

@nbbeeken nbbeeken self-requested a review September 15, 2022 20:20
@nbbeeken nbbeeken added Primary Review In Review with primary reviewer, not yet ready for team's eyes Team Review Needs review from team and removed Primary Review In Review with primary reviewer, not yet ready for team's eyes labels Sep 15, 2022
nbbeeken
nbbeeken previously approved these changes Sep 15, 2022
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.

LGTM, barring some bikeshedding on slack

@baileympearson baileympearson merged commit 9883993 into main Sep 16, 2022
@baileympearson baileympearson deleted the NODE-4637-clean-up-async-interval branch September 16, 2022 13:08
ZLY201 pushed a commit to ZLY201/node-mongodb-native that referenced this pull request Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
2 participants