mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-22 01:25:44 +03:00
Handle a potential race in the notifier when calling get_events_for which resulted in an uncaught KeyError
This commit is contained in:
parent
6904952ec4
commit
6df83555cc
1 changed files with 7 additions and 3 deletions
|
@ -166,9 +166,13 @@ class Notifier(object):
|
||||||
"""
|
"""
|
||||||
logger.debug("%s is listening for events.", user_id)
|
logger.debug("%s is listening for events.", user_id)
|
||||||
|
|
||||||
if len(self.stored_event_listeners[user_id][stream_id]["chunk"]) > 0:
|
try:
|
||||||
|
streams = self.stored_event_listeners[user_id][stream_id]["chunk"]
|
||||||
|
if streams:
|
||||||
logger.debug("%s returning existing chunk.", user_id)
|
logger.debug("%s returning existing chunk.", user_id)
|
||||||
return self.stored_event_listeners[user_id][stream_id]
|
return streams
|
||||||
|
except KeyError:
|
||||||
|
return None
|
||||||
|
|
||||||
reactor.callLater(
|
reactor.callLater(
|
||||||
(timeout / 1000.0), self._timeout, user_id, stream_id
|
(timeout / 1000.0), self._timeout, user_id, stream_id
|
||||||
|
|
Loading…
Reference in a new issue