Don't try to cancel already-expired timers - SYN-230

This commit is contained in:
Paul "LeoNerd" Evans 2015-01-13 16:57:28 +00:00
parent 3891597eb3
commit c2e7c84e58

View File

@ -120,6 +120,10 @@ class TypingNotificationHandler(BaseHandler):
member = RoomMember(room_id=room_id, user=target_user) member = RoomMember(room_id=room_id, user=target_user)
if member in self._member_typing_timer:
self.clock.cancel_call_later(self._member_typing_timer[member])
del self._member_typing_timer[member]
yield self._stopped_typing(member) yield self._stopped_typing(member)
@defer.inlineCallbacks @defer.inlineCallbacks
@ -142,8 +146,10 @@ class TypingNotificationHandler(BaseHandler):
del self._member_typing_until[member] del self._member_typing_until[member]
self.clock.cancel_call_later(self._member_typing_timer[member]) if member in self._member_typing_timer:
del self._member_typing_timer[member] # Don't cancel it - either it already expired, or the real
# stopped_typing() will cancel it
del self._member_typing_timer[member]
@defer.inlineCallbacks @defer.inlineCallbacks
def _push_update(self, room_id, user, typing): def _push_update(self, room_id, user, typing):