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

[IMPROVED] Server pool is updated based on server notifications #344

Merged
merged 1 commit into from
Mar 1, 2018

Conversation

kozlovic
Copy link
Member

The server pool was only growing when new servers were discovered.
Now, the client library updates its server pool based on server's
INFO protocols (true for server 1.0.6+).
The DiscoveredServersCB is still invoked only when new servers
are added (as in never seen as opposed to added back after leaving
the cluster).

The code should work ok with older servers but will take advantage
of changes in the server (nats-io/nats-server#626)

The server pool was only growing when new servers were discovered.
Now, the client library updates its server pool based on server's
INFO protocols (true for server 1.0.6+).
The DiscoveredServersCB is still invoked only when new servers
are added (as in never seen as opposed to added back after leaving
the cluster).

The code should work ok with older servers but will take advantage
of changes in the server (nats-io/nats-server#626)
@kozlovic
Copy link
Member Author

Note that one test checks that server version will be 1.0.6+ since test expects INFO content to be updated when servers leave the cluster, which does not happen with current version (1.0.4) of the server.

@coveralls
Copy link

coveralls commented Feb 27, 2018

Coverage Status

Coverage increased (+0.07%) to 94.834% when pulling 82fff71 on update_srv_pool_from_info into 45807e5 on master.

@derekcollison
Copy link
Member

LGTM

@kozlovic kozlovic merged commit fbd8504 into master Mar 1, 2018
@kozlovic kozlovic deleted the update_srv_pool_from_info branch March 1, 2018 00:12
kozlovic added a commit that referenced this pull request Mar 16, 2018
Continuation of #344. We don't want to remove discovered servers
from the pool if we get an INFO with empty array. The new servers
will send arrays with at least their own URL, but older servers
or in some situations, the array could be empty (omitted) and we
should not treat this as if there were no server at all in the
cluster.
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.

3 participants