-
Notifications
You must be signed in to change notification settings - Fork 18
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
Forever reconnect to other clients upon failure #909
Conversation
5bf3029
to
d295088
Compare
Codecov Report
@@ Coverage Diff @@
## master #909 +/- ##
==========================================
- Coverage 90.38% 90.27% -0.12%
==========================================
Files 41 41
Lines 3057 3104 +47
Branches 389 388 -1
==========================================
+ Hits 2763 2802 +39
- Misses 209 214 +5
- Partials 85 88 +3
Continue to review full report at Codecov.
|
c1da26e
to
da5fc99
Compare
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
One question below.
src/raiden_libs/matrix.py
Outdated
|
||
except RuntimeError as ex: | ||
if available_servers is None: | ||
raise ex |
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.
To re-raise just raise
is enough and will preserve the original traceback.
while not self.stop_event.is_set(): | ||
stopped_client = self.server_url_to_other_clients.pop(server_url, None) | ||
if stopped_client is not None: | ||
self.user_manager.remove_client(stopped_client) | ||
try: | ||
client = self._start_client(server_url) | ||
assert client.sync_worker is not None | ||
client.sync_worker.get() | ||
except (TransportError, ConnectionError): | ||
log.debug("Could not connect to server", server_url=server_url) |
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.
Hm unless I'm missing something this looks to me like it will re-connect to the server in each loop without checking if the connection is actually dead?
Ok I did miss the client.sync_worker.get()
.
Also this probably needs a lock so the state of the server_url_to_other_clients
dict is consistent.
fix test fix circular dependency test for client connect forever fix lint only fetch server list if it is chainID supported by RSB raise
14a9d31
to
438516e
Compare
fix client manager test
This PR introduces the ClientManager which controls the status of matrix clients to their respective home server. Each home server has a
connect_client_worker
which will trigger the creation of a new client if the connection to the homeserver fails.A reconnect is described by creating a new client object, logging into the server, joining broadcast rooms and starting the greenlet
listen_forever
.