-
Notifications
You must be signed in to change notification settings - Fork 12
connection: fix reconnect throwing in some cases #345
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
Conversation
Fix reconnection throwing when the error during the process also led to the `close` event being emitted on the `connection` object.
lundibundi
left a comment
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
| options = this.client._connectionOptions; | ||
| } | ||
| this.emit('reconnectAttempt', transport, ...options); | ||
| transports[transport].reconnect(this, ...options, (err, ...rest) => { |
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.
I'd suggest to add null check for 'reconnect' here to make it optional, as it truly is.
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.
First of all, this has nothing to do with this PR, thus it has to be done separately, second of all, I think reconnect function must not be allowed to be optional in any transport.
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.
Well, I don't think reconnect is essential for normal execution on the same level as for example connect is, imo it's just a convenient and automatic way of reusing the connection, the user may still decide that he want to just reconnect via other means or don't reconnect at all.
Anyways, this is not blocking the PR so it's okay and requires further discussion.
Fix reconnection throwing when the error during the process also led to the `close` event being emitted on the `connection` object. PR-URL: #345 Reviewed-By: Dmytro Nechai <nechaido@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
|
Landed in 0211096. |
Fix reconnection throwing when the error during the process also led to the `close` event being emitted on the `connection` object. PR-URL: #345 Reviewed-By: Dmytro Nechai <nechaido@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Fix reconnection throwing when the error during the process also led to
the
closeevent being emitted on theconnectionobject.