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: ensure connect event is fired only once #8

Merged
merged 1 commit into from
Sep 7, 2021

Conversation

veyh
Copy link
Contributor

@veyh veyh commented Sep 7, 2021

Hey, thanks for the library. I found a bug with the reconnects, and here's a fix.

Basically, when connect() failed and it started reconnecting, it kept adding more and more listeners to pgClient connect event, and when it finally fired, all those listeners would also fire. So if it had to reconnect 5 times before succeeding, the connect event would have been fired 6 times.

Try the test without the fix, it will fail.

When connect() failed and it started reconnecting, it kept adding more
and more listeners to pgClient connect event, and when it finally
fired, all those listeners would also fire. So if it had to reconnect 5
times before succeeding, the connect event would have been fired 6
times.
@veyh veyh force-pushed the fix-multiple-connect-events branch from 140761d to ab9a4b6 Compare September 7, 2021 08:40
@Mikhus Mikhus merged commit 40d537f into imqueue:master Sep 7, 2021
@Mikhus
Copy link
Member

Mikhus commented Sep 7, 2021

Thank you for contribution!

@Mikhus
Copy link
Member

Mikhus commented Sep 7, 2021

Fix published in v1.5.2+

@veyh veyh deleted the fix-multiple-connect-events branch September 8, 2021 06: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.

2 participants