Clear the list of ongoing syncs on shutdown

This commit is contained in:
Mark Haines 2016-06-03 15:02:27 +01:00
parent da491e75b2
commit 48340e4f13
1 changed files with 9 additions and 0 deletions

View File

@ -163,6 +163,8 @@ class SynchrotronPresence(object):
UPDATE_SYNCING_USERS_MS,
)
reactor.addSystemEventTrigger("before", "shutdown", self._on_shutdown)
def set_state(self, user, state):
# TODO Hows this supposed to work?
pass
@ -193,6 +195,13 @@ class SynchrotronPresence(object):
defer.returnValue(_user_syncing())
@defer.inlineCallbacks
def _on_shutdown(self):
# When the synchrotron is shutdown tell the master to clear the in
# progress syncs for this process
self.user_to_num_current_syncs.clear()
yield self._send_syncing_users_now()
def _send_syncing_users_regularly(self):
# Only send an update if we aren't in the middle of sending one.
if not self._sending_sync: