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

feat(connection): make connection helpers respect bufferTimeoutMS #15229

Merged
merged 5 commits into from
Feb 4, 2025

Conversation

vkarpov15
Copy link
Collaborator

@vkarpov15 vkarpov15 commented Feb 3, 2025

Fix #15201

Summary

#15201 pointed out an issue where we need to clear a connection's _lastHeartbeatAt when disconnecting, otherwise reconnecting after disconnecting can lead to the connection falsely thinking it is disconnected. This PR makes Mongoose set _lastHeartbeatAt = null when disconnecting and when connecting, to ensure we can rely on _lastHeartbeatAt as an accurate representation of the last time we received a serverHeartbeatSucceeded on this connection.

As some followup work, I also made it so that _waitForConnect() respects bufferTimeoutMS. Right now bufferTimeoutMS applies to collection operations (find(), etc.) but not connection operations (listCollections(), createCollection(), etc.), which is very inconsistent because this means connection operations can hang forever.

Examples

@vkarpov15 vkarpov15 added this to the 8.10 milestone Feb 3, 2025
test/connection.test.js Outdated Show resolved Hide resolved
@vkarpov15 vkarpov15 changed the base branch from master to 8.10 February 4, 2025 15: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.

Model init can hang
2 participants