Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
looping_call() will wait for the given function to finish before sc…
Browse files Browse the repository at this point in the history
…heduling another

Thanks to @erikjohnston for clarifying, #15743 (comment)

We don't have to worry about calls stacking up if the given function takes longer than the scheduled time.
  • Loading branch information
MadLittleMods committed Jun 12, 2023
1 parent ba97b39 commit dc91c4f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions synapse/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ def looping_call(
Waits `msec` initially before calling `f` for the first time.
If the function given to `looping_call` returns an awaitable/deferred, the next call isn't
scheduled until after the returned awaitable has finished. We get this
functionality thanks to this function being a thin wrapper around
`twisted.internet.task.LoopingCall`.
Note that the function will be called with no logcontext, so if it is anything
other than trivial, you probably want to wrap it in run_as_background_process.
Expand Down

0 comments on commit dc91c4f

Please sign in to comment.