summary refs log tree commit diff
path: root/synapse/api/notifier.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--synapse/api/notifier.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/synapse/api/notifier.py b/synapse/api/notifier.py
index 22d2914d38..105a11401b 100644
--- a/synapse/api/notifier.py
+++ b/synapse/api/notifier.py
@@ -166,9 +166,13 @@ class Notifier(object):
         """
         logger.debug("%s is listening for events.", user_id)
 
-        if len(self.stored_event_listeners[user_id][stream_id]["chunk"]) > 0:
-            logger.debug("%s returning existing chunk.", user_id)
-            return self.stored_event_listeners[user_id][stream_id]
+        try:
+            streams = self.stored_event_listeners[user_id][stream_id]["chunk"]
+            if streams:
+                logger.debug("%s returning existing chunk.", user_id)
+                return streams
+        except KeyError:
+            return None
 
         reactor.callLater(
             (timeout / 1000.0), self._timeout, user_id, stream_id