summary refs log tree commit diff
path: root/synapse/util/__init__.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-02-11 10:33:19 +0000
committerErik Johnston <erik@matrix.org>2015-02-11 10:33:19 +0000
commitfb233dc40b3111e905e394e627b8ecc3b2a91e80 (patch)
tree931ab474f042b5eb5df9663306a4936406dcf17c /synapse/util/__init__.py
parentPEP8 (diff)
parentMerge branch 'master' of github.com:matrix-org/synapse into develop (diff)
downloadsynapse-fb233dc40b3111e905e394e627b8ecc3b2a91e80.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into timeout-federation-requests
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 2da8dfa719..29f1344c5b 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 defer, reactor +from twisted.internet import defer, 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 stop_looping_call(self, loop): + loop.stop() + def call_later(self, delay, callback): current_context = LoggingContext.current_context()