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

reconnect-jitter-handler-serverinfo-tests #391

Merged
merged 4 commits into from
Dec 29, 2020
Merged

reconnect-jitter-handler-serverinfo-tests #391

merged 4 commits into from
Dec 29, 2020

Conversation

scottf
Copy link
Contributor

@scottf scottf commented Dec 28, 2020

No description provided.

byte[] getNonce();
boolean isJetStreamAvailable();
int getClientId();
String getClientIp();
Copy link
Member

Choose a reason for hiding this comment

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

Decided on the string...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. The InetAddress has static methods that the dev can call directly to find out info you were describing.

// prioritize discovered over configured
List<String> servers = new ArrayList<>();
addDiscoveredServers(servers);
shuffleWithoutCurrent(servers);
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't shuffle be called once after adding discovered and then configured?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The thought here was that discovered servers are the most viable and contain the list of configured servers, although possible in a ip form instead of a dns name form. In fact I'm not even sure of the value of adding the configured servers in the list once the discovered are populated.

Copy link
Member

Choose a reason for hiding this comment

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

Discovered servers should be only servers that weren't originally configured. For example, if I have servers A, B, and C configured in the client then added D and E, the client would have A,B,C as configured servers and D and E as a discovered servers. Randomization should be applied to the whole list (sans current during reconnect), so each server will be weighted equally in probability w/r/t reconnect order. Someday we'll have classes of servers for regional preference (e.g. try this set first, then if all those fail, try another set), but that's TBD at the moment.

There is a chance for duplicates based on IP vs hostname, but server configuration allows ops to handle that.

Copy link
Member

@ColinSullivan1 ColinSullivan1 left a comment

Choose a reason for hiding this comment

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

Looks good - just a few questions...

Copy link
Member

@ColinSullivan1 ColinSullivan1 left a comment

Choose a reason for hiding this comment

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

LGTM - Thanks!

@ColinSullivan1 ColinSullivan1 merged commit 10594e2 into nats-io:master Dec 29, 2020
@scottf scottf deleted the reconnect-jitter-handler-serverinfo-tests branch January 25, 2021 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants