summary refs log tree commit diff
path: root/synapse/handlers/typing.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-11-01 13:14:04 +0000
committerErik Johnston <erik@matrix.org>2016-11-01 13:14:04 +0000
commit4a9055d4465d5d6059612e7c89f2b5774efc0e18 (patch)
treef5d146248431ce35f1ad810267024af4eb907bdf /synapse/handlers/typing.py
parentMerge branch 'release-v0.18.1' of github.com:matrix-org/synapse (diff)
parentBump version and changelog (diff)
downloadsynapse-4a9055d4465d5d6059612e7c89f2b5774efc0e18.tar.xz
Merge branch 'release-v0.18.2' of github.com:matrix-org/synapse v0.18.2
Diffstat (limited to 'synapse/handlers/typing.py')
-rw-r--r--synapse/handlers/typing.py12
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, [])