summary refs log tree commit diff
path: root/synapse/app
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2016-06-06 16:37:12 +0100
committerMark Haines <mark.haines@matrix.org>2016-06-06 16:37:12 +0100
commit4a5bbb1941ae63f1d6632aa35e80274e56c8dbb9 (patch)
tree8efe7ccd42df8be08264111726ac99c66fed5659 /synapse/app
parentMerge pull request #841 from matrix-org/erikj/event_counter (diff)
downloadsynapse-4a5bbb1941ae63f1d6632aa35e80274e56c8dbb9.tar.xz
Fix a KeyError in the synchrotron presence
Diffstat (limited to 'synapse/app')
-rw-r--r--synapse/app/synchrotron.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/app/synchrotron.py b/synapse/app/synchrotron.py
index aa81e1c5da..3d0d5cc15a 100644
--- a/synapse/app/synchrotron.py
+++ b/synapse/app/synchrotron.py
@@ -187,7 +187,10 @@ class SynchrotronPresence(object):
                 yield self._send_syncing_users_now()
 
         def _end():
-            if affect_presence:
+            # We check that the user_id is in user_to_num_current_syncs because
+            # user_to_num_current_syncs may have been cleared if we are
+            # shutting down.
+            if affect_presence and user_id in self.user_to_num_current_syncs:
                 self.user_to_num_current_syncs[user_id] -= 1
 
         @contextlib.contextmanager