summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2016-06-03 15:02:27 +0100
committerMark Haines <mjark@negativecurvature.net>2016-06-03 15:02:27 +0100
commit48340e4f13a8090feac070ebb507e7629d03b530 (patch)
tree39e8320a93cba905d11530f2199eaa3b3441cf00 /synapse
parentAppease flake8 (diff)
downloadsynapse-48340e4f13a8090feac070ebb507e7629d03b530.tar.xz
Clear the list of ongoing syncs on shutdown
Diffstat (limited to 'synapse')
-rw-r--r--synapse/app/synchrotron.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/synapse/app/synchrotron.py b/synapse/app/synchrotron.py

index af06ce70d1..f4b416f777 100644 --- a/synapse/app/synchrotron.py +++ b/synapse/app/synchrotron.py
@@ -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: