소스 검색

Merge pull request #845 from matrix-org/markjh/synchrotron_presence

Fix a KeyError in the synchrotron presence
Mark Haines 8 년 전
부모
커밋
b0932b34cb
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      synapse/app/synchrotron.py

+ 4 - 1
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