summary refs log tree commit diff
path: root/synapse/util
diff options
context:
space:
mode:
authorBrendan Abolivier <babolivier@matrix.org>2019-07-29 10:03:14 +0200
committerBrendan Abolivier <babolivier@matrix.org>2019-07-29 11:06:43 +0200
commitbec6d9e09015a5775147ca31416f9c27ed46a23b (patch)
tree5a8fcd6cec68e56dbf14eff54230782fde4fa7e1 /synapse/util
parentAdd ability to pass arguments to looping calls (diff)
downloadsynapse-bec6d9e09015a5775147ca31416f9c27ed46a23b.tar.xz
Add kwargs and doc
Diffstat (limited to 'synapse/util')
-rw-r--r--synapse/util/__init__.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/util/__init__.py b/synapse/util/__init__.py
index 5277f30d30..8f5a526800 100644
--- a/synapse/util/__init__.py
+++ b/synapse/util/__init__.py
@@ -58,7 +58,7 @@ class Clock(object):
         """Returns the current system time in miliseconds since epoch."""
         return int(self.time() * 1000)
 
-    def looping_call(self, f, msec, *args):
+    def looping_call(self, f, msec, *args, **kwargs):
         """Call a function repeatedly.
 
          Waits `msec` initially before calling `f` for the first time.
@@ -66,8 +66,10 @@ class Clock(object):
         Args:
             f(function): The function to call repeatedly.
             msec(float): How long to wait between calls in milliseconds.
+            *args: Postional arguments to pass to function.
+            **kwargs: Key arguments to pass to function.
         """
-        call = task.LoopingCall(f, *args)
+        call = task.LoopingCall(f, *args, **kwargs)
         call.clock = self._reactor
         d = call.start(msec / 1000.0, now=False)
         d.addErrback(