handle websocket unsubscribe

* Do not return from blocking unsubscribe until _after_ putting the
gotten unsubscribe message on the queue so that it can be read by the
thread of execution that was unblocked.
This commit is contained in:
chris meyers 2020-02-17 09:04:16 -05:00 committed by Ryan Petrello
parent 3c5c9c6fde
commit 14320bc8e6
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777

View File

@ -210,11 +210,13 @@ class WSClient(object):
self._should_subscribe_to_pending_job['events'] == 'project_update_events'):
self._update_subscription(message['unified_job_id'])
ret = self._recv_queue.put(message)
# unsubscribe acknowledgement
if 'groups_current' in message:
self._pending_unsubscribe.set()
return self._recv_queue.put(message)
return ret
def _update_subscription(self, job_id):
subscription = dict(jobs=self._should_subscribe_to_pending_job['jobs'])