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: Emit connectFailed on connection failure. #223

Merged
merged 3 commits into from
Jan 7, 2022
Merged

Conversation

jwalton
Copy link
Owner

@jwalton jwalton commented Jan 7, 2022

Fixes #222.

This makes it so instead of emitting a disconnect event the first time we fail to connect, AmqpConnectionManager now emits a connectFailed. AmqpConnectionManager emits connectFailed on every connection failure, and emits disconnect only when we transition from connected to disconnected.

BREAKING CHANGE: We will no longer emit a disconnect event on an
initial connection failure - instead we now emit connectFailed on each
connection failure, and only emit disconnect when we transition from
connected to disconnected.

fix #222

BREAKING CHANGE: We will no longer emit a `disconnect` event on an
initial connection failure - instead we now emit `connectFailed` on each
connection failure, and only emit `disconnect` when we transition from
connected to disconnected.
* successful, failed, or in-progress..
*/
get connectionAttempts(): number {
return this._connectionAttempts;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we maybe rename it to pendingConnectionAttempts etc. and reset it on connect? Not sure ever increasing counter has sense?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pendingConnectionAttempts makes it sound like it should either be 1 or 0 (we're trying to connect or we're not).

connectionAttemptsSinceLastConnect? That's a bit wordy.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take the connection attempt count out for now - you can always track it yourself from the event if you really need it, and then we can get this merged.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is perfectly fine for me, actually that's how I was doing it till now, so just need to change the listened event. Thank you

@ssukienn
Copy link

ssukienn commented Jan 7, 2022

Ty a lot for the PR, single comment. Othewise, lgtm.

BREAKING CHANGE: No longer running unit tests on node 10 and 12, although this package may continue to work on these.
@jwalton jwalton merged commit f2eee58 into master Jan 7, 2022
@jwalton jwalton deleted the connection-attempt branch January 7, 2022 18:30
@jwalton
Copy link
Owner Author

jwalton commented Jan 7, 2022

🎉 This PR is included in version 4.0.0 🎉

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
Development

Successfully merging this pull request may close these issues.

Event for failing reconnection
2 participants