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

mongoose.disconnect won't stop the connection if a reconnect is in progress #9531

Closed
dbellavista opened this issue Nov 9, 2020 · 0 comments
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Milestone

Comments

@dbellavista
Copy link

Do you want to request a feature or report a bug?
bug

What is the current behavior?

When using autoReconnect: true, the connection to mongodb is automatically restored once the database is up again. However if mongoose.disconnect() is invoked when the connection is in a disconnected state, the connection is not really terminated and would proceed with the automatic reconnection.

This can be a problem in a production environment when a graceful shutdown of the application would hang if one connection is currently waiting to reconnect.

If the current behavior is a bug, please provide the steps to reproduce.

https://gist.github.com/dbellavista/e65aaf56719a6bd028b07ab3eb756f8e

What is the expected behavior?

The mongoose.disconnect method should prevent reconnection from happening, allowing the process to exit.

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.

  • node.js v12.19.0
  • mongoose 5.10.13
  • mongodb 4.4
@vkarpov15 vkarpov15 modified the milestones: 5.10.14, 5.10.15 Nov 10, 2020
@vkarpov15 vkarpov15 added the enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature label Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Projects
None yet
Development

No branches or pull requests

2 participants