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

Handle connection after connect event was emitted #1095

Merged
merged 2 commits into from
Apr 11, 2020

Conversation

alavers
Copy link
Contributor

@alavers alavers commented Apr 5, 2020

It's possible for connect promise to resolve after the resolved
connection has already been established, which means we miss the connect
event. This can happen when Bluebird is set as the global Promise, and
we connect to an ip address host for example. This fix checks to see if
that's the case and invokes the connection handler directly. Thanks
@luin for the recommendation.

Fixes #977

It's possible for connect promise to resolve after the resolved
connection has already been established, which means we miss the connect
event. This can happen when Bluebird is set as the global Promise, and
we connect to an ip address host for example. This fix checks to see if
that's the case and invokes the connection handler directly. Thanks
@luin for the recommendation.

Fixes redis#977
@luin
Copy link
Collaborator

luin commented Apr 5, 2020

I think we should ignore connectTimeout option in this case right?
https://github.com/luin/ioredis/blob/ec76383a1a85e02aca44954b48c719a69e291e90/lib/redis/index.ts#L315

@alavers
Copy link
Contributor Author

alavers commented Apr 6, 2020

@luin You're right! Pushed a fix

@bvallelunga
Copy link

Thanks @alavers and @imatlopez for putting up a fix! Dealing with this bug right now and was hoping a fix would come out. Do you think we can get this merged and published soon?

@luin luin merged commit 16a0610 into redis:master Apr 11, 2020
ioredis-robot pushed a commit that referenced this pull request Apr 11, 2020
## [4.16.2](v4.16.1...v4.16.2) (2020-04-11)

### Bug Fixes

* dismiss security alerts for dev dependencies [skip release] ([758b3f2](758b3f2))
* handle connection after connect event was emitted ([#1095](#1095)) ([16a0610](16a0610)), closes [#977](#977)
@ioredis-robot
Copy link
Collaborator

🎉 This PR is included in version 4.16.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@alavers alavers deleted the handle-fast-connection branch April 11, 2020 15:34
janus-dev87 added a commit to janus-dev87/ioredis-work that referenced this pull request Mar 1, 2024
## [4.16.2](redis/ioredis@v4.16.1...v4.16.2) (2020-04-11)

### Bug Fixes

* dismiss security alerts for dev dependencies [skip release] ([758b3f2](redis/ioredis@758b3f2))
* handle connection after connect event was emitted ([#1095](redis/ioredis#1095)) ([16a0610](redis/ioredis@16a0610)), closes [#977](redis/ioredis#977)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error: connect ETIMEDOUT ----use bluebird
5 participants