projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
6706: Add comments about what is going on with EventClient.close()
[arvados.git]
/
sdk
/
python
/
arvados
/
events.py
diff --git
a/sdk/python/arvados/events.py
b/sdk/python/arvados/events.py
index 15bcf2c0ddfe7a70c35a7d7f840ceed3acae6209..4581f05b8ad9dd9830051ff2490b25c053379c8f 100644
(file)
--- a/
sdk/python/arvados/events.py
+++ b/
sdk/python/arvados/events.py
@@
-41,8
+41,16
@@
class EventClient(WebSocketClient):
self.stop.set()
def close(self, code=1000, reason=''):
self.stop.set()
def close(self, code=1000, reason=''):
+ # parent close() method sends a asynchronous "closed" event to the server
super(EventClient, self).close(code, reason)
super(EventClient, self).close(code, reason)
+
+ # if server doesn't respond by finishing the close handshake, we'll be
+ # stuck in limbo forever. We don't need to wait for the server to
+ # respond to go ahead and actually close the socket.
self.close_connection()
self.close_connection()
+
+ # wait for websocket thread to finish up (closed() is called by
+ # websocket thread in as part of terminate())
while not self.stop.is_set():
self.stop.wait(1)
while not self.stop.is_set():
self.stop.wait(1)