This repository was archived by the owner on Jul 31, 2020. It is now read-only.
feat(socket): use round robin for endpoints when the connection fails#92
Merged
ProbablePrime merged 2 commits intomasterfrom Jan 26, 2018
Merged
feat(socket): use round robin for endpoints when the connection fails#92ProbablePrime merged 2 commits intomasterfrom
ProbablePrime merged 2 commits intomasterfrom
Conversation
SimonSchick
suggested changes
Jan 4, 2018
src/wire/Socket.ts
Outdated
| * Close codes that are deemed to be recoverable by the reconnection policy | ||
| */ | ||
| export const recoverableCloseCodes = [1000, 1011]; | ||
| export const recoverableCloseCodes = [1000, 1001, 1006, 1011, 1012]; |
Contributor
There was a problem hiding this comment.
Can we please use an enum for those?
Contributor
There was a problem hiding this comment.
Contributor
Author
There was a problem hiding this comment.
These were normal ws closure codes, rather than codes specifically sent by tetrisd. But thinking about it, it probably makes more sense to rid of this altogether and just reconnect on any 1xxx error. Only issue there is that Edge serves 1005 for all closures, so that may have to be excluded for compatibility.
Contributor
There was a problem hiding this comment.
It still makes sense to define an enum rather than throwing random numbers around.
src/wire/Socket.ts
Outdated
|
|
||
| private getURL(): string { | ||
| const addresses = this.options.urls; | ||
| if (this.endpointIndex >= addresses.length) { |
Contributor
There was a problem hiding this comment.
eg. return addresses[endpointIndex % addresses.length]
SimonSchick
approved these changes
Jan 9, 2018
ProbablePrime
approved these changes
Jan 26, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If the connection to interactive is dropped, connect to the next server served by
/interactive/hosts(and cycle through them). Also expands the recoverable error codes to include CloudFlare errors, server restarts, etc.