diff options
author | Erik Johnston <erikj@jki.re> | 2016-10-25 10:59:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-25 10:59:59 +0100 |
commit | 25423f50aa70ed4f6728b341865eee229ed5db6a (patch) | |
tree | a14bb69f331007882ba3879544ad0c0f67fe8508 | |
parent | Merge pull request #1178 from matrix-org/erikj/current_room_token (diff) | |
parent | Fix infinite typing bug (diff) | |
download | synapse-25423f50aa70ed4f6728b341865eee229ed5db6a.tar.xz |
Merge pull request #1179 from matrix-org/erikj/typing_timer_paranoia
Fix infinite typing bug
Diffstat (limited to '')
-rw-r--r-- | synapse/handlers/typing.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/synapse/handlers/typing.py b/synapse/handlers/typing.py index 08313417b2..27ee715ff0 100644 --- a/synapse/handlers/typing.py +++ b/synapse/handlers/typing.py @@ -88,7 +88,7 @@ class TypingHandler(object): continue until = self._member_typing_until.get(member, None) - if not until or until < now: + if not until or until <= now: logger.info("Timing out typing for: %s", member.user_id) preserve_fn(self._stopped_typing)(member) continue @@ -97,12 +97,20 @@ class TypingHandler(object): # user. if self.hs.is_mine_id(member.user_id): last_fed_poke = self._member_last_federation_poke.get(member, None) - if not last_fed_poke or last_fed_poke + FEDERATION_PING_INTERVAL < now: + if not last_fed_poke or last_fed_poke + FEDERATION_PING_INTERVAL <= now: preserve_fn(self._push_remote)( member=member, typing=True ) + # Add a paranoia timer to ensure that we always have a timer for + # each person typing. + self.wheel_timer.insert( + now=now, + obj=member, + then=now + 60 * 1000, + ) + def is_typing(self, member): return member.user_id in self._room_typing.get(member.room_id, []) |