Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Added Monitor class to Connection. #105
Conversation
petevg
added some commits
Apr 4, 2017
petevg
changed the title from
[WIP] Added Monitor class to Connection.
to
Added Monitor class to Connection.
Apr 4, 2017
petevg
referenced this pull request
in juju-solutions/matrix
Apr 4, 2017
Merged
Matrix now fails rather than hangs when disconnected. #121
johnsca
approved these changes
Apr 5, 2017
LGTM.
Do you know if the AllWatcher task goes to done when the connection drops? If not, it would be good to tie this in to that so that the task doesn't sit there waiting for a response that will never come. Actually, an Event interface for detecting connection drop similar to model._watch_received (but public) might be nice.
|
@johnsca if you drill down the AllWatcher task ends up repeatedly calling connection.recv (via Type.rpc, via AllModelWatcherFacade.Next), which, thanks to a change you made, raises an Exception if the connection unexpectedly closes. So the future should make it into the "done" state, with an .exception on it. I'm going to go ahead and merge this :-) |
petevg commentedApr 4, 2017
•
Edited 1 time
-
petevg
Apr 4, 2017
Calling Monitor.status allows a client to determine whether the
connection is "connected", "disconnected" or in an "error" state, and
take appropriate action as a result.
This is meant to address the issue of watchers failing silently when the
websocket connection goes away due to a network issue.
@tvansteenburgh @johnsca @abentley Addresses #99. WIP because I want to write some matrix code that uses this and validate that it actually solves my problem. Edit: no longer WIP, as this works quite nicely in matrix :-)