Skip to content

Conversation

@belochub
Copy link
Member

Fix reconnection throwing when the error during the process also led to
the close event being emitted on the connection object.

Fix reconnection throwing when the error during the process also led to
the `close` event being emitted on the `connection` object.
@belochub belochub self-assigned this Jul 11, 2018
@belochub belochub requested a review from nechaido July 11, 2018 01:02
Copy link
Member

@lundibundi lundibundi left a 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) => {
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

belochub added a commit that referenced this pull request Jul 12, 2018
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>
@belochub
Copy link
Member Author

Landed in 0211096.

@belochub belochub closed this Jul 12, 2018
@belochub belochub deleted the fix-reconnection-throwing branch July 12, 2018 16:28
belochub added a commit that referenced this pull request Aug 30, 2018
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>
@belochub belochub mentioned this pull request Aug 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants