Skip to content
Snippets Groups Projects
Commit 6df83555 authored by Erik Johnston's avatar Erik Johnston
Browse files

Handle a potential race in the notifier when calling get_events_for which...

Handle a potential race in the notifier when calling get_events_for which resulted in an uncaught KeyError
parent 6904952e
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment