summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-09-23 15:43:34 +0100
committerErik Johnston <erik@matrix.org>2016-09-23 15:43:34 +0100
commit655891d179da91206525054eca1aaec562c37e66 (patch)
tree5a8153fe0b8552f6624847bb29b6a12cd6b8f91f /synapse
parentTime out typing over federation (diff)
downloadsynapse-655891d179da91206525054eca1aaec562c37e66.tar.xz
Move FEDERATION_PING_INTERVAL timer. Update log line
Diffstat (limited to 'synapse')
-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(