Skip to content

Commit

Permalink
Attempt to fix bug where we 500d an event stream due to trying to can…
Browse files Browse the repository at this point in the history
…cel a timer twice
  • Loading branch information
erikjohnston committed Nov 26, 2014
1 parent 858e87a commit 00ab5cd
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions synapse/handlers/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ def get_stream(self, auth_user_id, pagin_config, timeout=0):
if auth_user not in self._streams_per_user:
self._streams_per_user[auth_user] = 0
if auth_user in self._stop_timer_per_user:
self.clock.cancel_call_later(
self._stop_timer_per_user.pop(auth_user))
try:
self.clock.cancel_call_later(
self._stop_timer_per_user.pop(auth_user)
)
except:
logger.exception("Failed to cancel event timer")
else:
yield self.distributor.fire(
"started_user_eventstream", auth_user
Expand Down Expand Up @@ -95,10 +99,12 @@ def _later():
logger.debug(
"_later stopped_user_eventstream %s", auth_user
)

self._stop_timer_per_user.pop(auth_user, None)

yield self.distributor.fire(
"stopped_user_eventstream", auth_user
)
del self._stop_timer_per_user[auth_user]

logger.debug("Scheduling _later: for %s", auth_user)
self._stop_timer_per_user[auth_user] = (
Expand Down

0 comments on commit 00ab5cd

Please sign in to comment.