summary refs log tree commit diff
path: root/synapse/util/__init__.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-02-06 16:08:13 +0000
committerErik Johnston <erik@matrix.org>2015-02-06 16:08:13 +0000
commitc4e3029d55c228375725ccacd326e1ee5cc8dd73 (patch)
tree04c5d2241a5ed54861c7c3912a923dca67ff810b /synapse/util/__init__.py
parentExplicitly list the RejectedReasons that we can prove (diff)
downloadsynapse-c4e3029d55c228375725ccacd326e1ee5cc8dd73.tar.xz
Add cache layer to state group resolution
Diffstat (limited to 'synapse/util/__init__.py')
-rw-r--r--synapse/util/__init__.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/synapse/util/__init__.py b/synapse/util/__init__.py
index 4e837a918e..1fd5ba5787 100644
--- a/synapse/util/__init__.py
+++ b/synapse/util/__init__.py
@@ -15,7 +15,7 @@
 
 from synapse.util.logcontext import LoggingContext
 
-from twisted.internet import reactor
+from twisted.internet import reactor, task
 
 import time
 
@@ -35,6 +35,14 @@ class Clock(object):
         """Returns the current system time in miliseconds since epoch."""
         return self.time() * 1000
 
+    def looping_call(self, f, msec):
+        l = task.LoopingCall(f)
+        l.start(msec/1000.0, now=False)
+        return l
+
+    def looping_call(self, loop):
+        loop.stop()
+
     def call_later(self, delay, callback):
         current_context = LoggingContext.current_context()