summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--synapse/handlers/typing.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/synapse/handlers/typing.py b/synapse/handlers/typing.py
index 505a68d142..08313417b2 100644
--- a/synapse/handlers/typing.py
+++ b/synapse/handlers/typing.py
@@ -53,7 +53,7 @@ class TypingHandler(object):
         self.hs = hs
 
         self.clock = hs.get_clock()
-        self.wheel_timer = WheelTimer()
+        self.wheel_timer = WheelTimer(bucket_size=5000)
 
         self.federation = hs.get_replication_layer()
 
@@ -76,7 +76,7 @@ class TypingHandler(object):
         )
 
     def _handle_timeouts(self):
-        logger.info("Handling typing timeout")
+        logger.info("Checking for typing timeouts")
 
         now = self.clock.time_msec()
 
@@ -136,12 +136,6 @@ class TypingHandler(object):
             then=now + timeout,
         )
 
-        self.wheel_timer.insert(
-            now=now,
-            obj=member,
-            then=now + FEDERATION_PING_INTERVAL,
-        )
-
         if was_present:
             # No point sending another notification
             defer.returnValue(None)
@@ -208,6 +202,14 @@ class TypingHandler(object):
     def _push_remote(self, member, typing):
         users = yield self.state.get_current_user_in_room(member.room_id)
         self._member_last_federation_poke[member] = self.clock.time_msec()
+
+        now = self.clock.time_msec()
+        self.wheel_timer.insert(
+            now=now,
+            obj=member,
+            then=now + FEDERATION_PING_INTERVAL,
+        )
+
         for domain in set(get_domain_from_id(u) for u in users):
             if domain != self.server_name:
                 self.federation.send_edu(