summary refs log tree commit diff
path: root/tests/utils.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2016-09-26 11:24:14 +0100
committerGitHub <noreply@github.com>2016-09-26 11:24:14 +0100
commita38d46249e5c9d9f5ac0276dce1c26320436d8e5 (patch)
treeb654c4551f2ac1ddf8a49a9109e5a8e1780e766e /tests/utils.py
parenttypo (diff)
parentMove FEDERATION_PING_INTERVAL timer. Update log line (diff)
downloadsynapse-a38d46249e5c9d9f5ac0276dce1c26320436d8e5.tar.xz
Merge pull request #1140 from matrix-org/erikj/typing_fed_timeout
Time out typing over federation
Diffstat (limited to 'tests/utils.py')
-rw-r--r--tests/utils.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/utils.py b/tests/utils.py
index 915b934e94..92d470cb48 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -220,6 +220,7 @@ class MockClock(object):
         # list of lists of [absolute_time, callback, expired] in no particular
         # order
         self.timers = []
+        self.loopers = []
 
     def time(self):
         return self.now
@@ -240,7 +241,7 @@ class MockClock(object):
         return t
 
     def looping_call(self, function, interval):
-        pass
+        self.loopers.append([function, interval / 1000., self.now])
 
     def cancel_call_later(self, timer, ignore_errs=False):
         if timer[2]:
@@ -269,6 +270,12 @@ class MockClock(object):
             else:
                 self.timers.append(t)
 
+        for looped in self.loopers:
+            func, interval, last = looped
+            if last + interval < self.now:
+                func()
+                looped[2] = self.now
+
     def advance_time_msec(self, ms):
         self.advance_time(ms / 1000.)