diff options
author | Erik Johnston <erik@matrix.org> | 2015-02-09 15:01:26 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-02-09 15:01:26 +0000 |
commit | 76c5a5c2f67bc24af553e78f83a85ef7d1906921 (patch) | |
tree | 42de17e8d55a5aa48ff3b43462f54569a221010e /synapse/util/__init__.py | |
parent | Fix server default rule injection (downwards, not upwards!) (diff) | |
parent | Fix typo (diff) | |
download | synapse-76c5a5c2f67bc24af553e78f83a85ef7d1906921.tar.xz |
Merge pull request #55 from matrix-org/profiling
Profiling
Diffstat (limited to 'synapse/util/__init__.py')
-rw-r--r-- | synapse/util/__init__.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/synapse/util/__init__.py b/synapse/util/__init__.py index 4e837a918e..fee76b0a9b 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 stop_looping_call(self, loop): + loop.stop() + def call_later(self, delay, callback): current_context = LoggingContext.current_context() |