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

fix(cmap): undo flipping of beforeHandshake flag for timeout errors #2813

Merged
merged 3 commits into from May 21, 2021
Merged

fix(cmap): undo flipping of beforeHandshake flag for timeout errors #2813

merged 3 commits into from May 21, 2021

Conversation

vkarpov15
Copy link
Contributor

Description

I ran into this issue when upgrading Mongoose to 3.6.7 (Automattic/mongoose#10265). 3.6.7 did some refactoring with f1afcc4 that seems to have unintentionally flipped the beforeHandshake flag on timeout errors. This causes the topology to always switch to 'Unknown' state when there's an operation timeout.

What changed?

Undoing a change that I think may have been accidental.

Are there any files to ignore?

@emadum emadum requested review from nbbeeken, emadum, a team and durran and removed request for a team May 20, 2021 19:17
Add a unit test to confirm this behavior doesn't regress
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.

Hey Val, thanks so much for catching this I want to expedite this fix a bit so I've taken the liberty of adding regression tests and making a small change to the way the flag is set on the error class.

Also JIRA tracking: NODE-3305

@nbbeeken nbbeeken requested a review from dariakp May 20, 2021 22:48
lib/core/error.js Outdated Show resolved Hide resolved
lib/cmap/connection.js Outdated Show resolved Hide resolved
Copy link
Contributor

@emadum emadum left a comment

Choose a reason for hiding this comment

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

LGTM 👍

- only define before handshake symbol if correct option is passed
- clean up chai usage
- rename tests
- add tests for symbol defining
@nbbeeken nbbeeken requested a review from dariakp May 21, 2021 16:51
Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants