mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 19:23:53 +01:00
Attempt to fix bug where we 500d an event stream due to trying to cancel a timer twice
This commit is contained in:
parent
858e87ab0d
commit
00ab5cd6f2
1 changed files with 9 additions and 3 deletions
|
@ -53,8 +53,12 @@ class EventStreamHandler(BaseHandler):
|
||||||
if auth_user not in self._streams_per_user:
|
if auth_user not in self._streams_per_user:
|
||||||
self._streams_per_user[auth_user] = 0
|
self._streams_per_user[auth_user] = 0
|
||||||
if auth_user in self._stop_timer_per_user:
|
if auth_user in self._stop_timer_per_user:
|
||||||
|
try:
|
||||||
self.clock.cancel_call_later(
|
self.clock.cancel_call_later(
|
||||||
self._stop_timer_per_user.pop(auth_user))
|
self._stop_timer_per_user.pop(auth_user)
|
||||||
|
)
|
||||||
|
except:
|
||||||
|
logger.exception("Failed to cancel event timer")
|
||||||
else:
|
else:
|
||||||
yield self.distributor.fire(
|
yield self.distributor.fire(
|
||||||
"started_user_eventstream", auth_user
|
"started_user_eventstream", auth_user
|
||||||
|
@ -95,10 +99,12 @@ class EventStreamHandler(BaseHandler):
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"_later stopped_user_eventstream %s", auth_user
|
"_later stopped_user_eventstream %s", auth_user
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self._stop_timer_per_user.pop(auth_user, None)
|
||||||
|
|
||||||
yield self.distributor.fire(
|
yield self.distributor.fire(
|
||||||
"stopped_user_eventstream", auth_user
|
"stopped_user_eventstream", auth_user
|
||||||
)
|
)
|
||||||
del self._stop_timer_per_user[auth_user]
|
|
||||||
|
|
||||||
logger.debug("Scheduling _later: for %s", auth_user)
|
logger.debug("Scheduling _later: for %s", auth_user)
|
||||||
self._stop_timer_per_user[auth_user] = (
|
self._stop_timer_per_user[auth_user] = (
|
||||||
|
|
Loading…
Reference in a new issue