diff options
author | Kegsay <kegsay@gmail.com> | 2016-11-14 12:45:30 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-14 12:45:30 +0000 |
commit | 9355a5c42b4003ea8749ed077c812ebba9a5f7cf (patch) | |
tree | d35934cc8031e0ddb4dfc2ad6f028e628d226481 /synapse/util | |
parent | Merge pull request #1625 from DanielDent/patch-1 (diff) | |
parent | Clean transactions based on time. Add HttpTransactionCache tests. (diff) | |
download | synapse-9355a5c42b4003ea8749ed077c812ebba9a5f7cf.tar.xz |
Merge pull request #1624 from matrix-org/kegan/idempotent-requests
Store Promise<Response> instead of Response for HTTP API transactions
Diffstat (limited to 'synapse/util')
-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 2b3f0bef3c..c05b9450be 100644 --- a/synapse/util/__init__.py +++ b/synapse/util/__init__.py @@ -34,7 +34,7 @@ class Clock(object): """A small utility that obtains current time-of-day so that time may be mocked during unit-tests. - TODO(paul): Also move the sleep() functionallity into it + TODO(paul): Also move the sleep() functionality into it """ def time(self): @@ -46,6 +46,14 @@ class Clock(object): return int(self.time() * 1000) def looping_call(self, f, msec): + """Call a function repeatedly. + + Waits `msec` initially before calling `f` for the first time. + + Args: + f(function): The function to call repeatedly. + msec(float): How long to wait between calls in milliseconds. + """ l = task.LoopingCall(f) l.start(msec / 1000.0, now=False) return l |