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

calling disconnect(true) multiple times #1138

Closed
alexandre-abrioux opened this issue May 27, 2020 · 1 comment
Closed

calling disconnect(true) multiple times #1138

alexandre-abrioux opened this issue May 27, 2020 · 1 comment
Labels

Comments

@alexandre-abrioux
Copy link
Contributor

alexandre-abrioux commented May 27, 2020

Hi!

I've noticed that calling the disconnect(true) sequentially multiple times actually cancels the re-connection process.

The issue resides in the disconnect method where the clearTimeout function is called regardless of whether or not the reconnect parameter is set to true:

public disconnect(reconnect = false) {
  ...
  if (this.reconnectTimeout) { // <-- here we should check if reconnect is also false
    clearTimeout(this.reconnectTimeout);
    ....
  }
  ...
}

I've made a fix that I will introduce in a new PR following the opening of this issue.

Thank you for your time!

PS: this issue might be related to #1007.

alexandre-abrioux added a commit to alexandre-abrioux/ioredis that referenced this issue May 27, 2020
alexandre-abrioux added a commit to alexandre-abrioux/ioredis that referenced this issue May 27, 2020
@luin luin closed this as completed in 6fad73b May 30, 2020
ioredis-robot pushed a commit that referenced this issue May 30, 2020
## [4.17.3](v4.17.2...v4.17.3) (2020-05-30)

### Bug Fixes

* race conditions in `Redis#disconnect()` can cancel reconnection unexpectedly ([6fad73b](6fad73b)), closes [#1138](#1138) [#1007](#1007)
@ioredis-robot
Copy link
Collaborator

ioredis-robot commented May 30, 2020

🎉 This issue has been resolved in version 4.17.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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