-
Notifications
You must be signed in to change notification settings - Fork 14
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
Emit a reconnectFailure event #81
Conversation
When the maximum number of backoffs is reached. Error can be undefined.
lib/TcpConnection.js
Outdated
@@ -144,7 +144,7 @@ module.exports = function factory (userOptions) { | |||
} | |||
} | |||
if (options.reconnect) { | |||
reconnect() | |||
reconnect(hadError && socketError) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcollina I'm thinking about it because it's a breaking change, do you think we should reconnect if the socket was closed (or ended) without an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no we shouldn't reconnect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
I've also added a test to make sure that a close
event is sent on the stream when the socket is gracefully closed using socket.destroy()
(without an error)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
err
can be undefined on fail event whenretryBackoff.backoff
is called without an error object: