diff options
author | Richard van der Hoff <richard@matrix.org> | 2018-04-27 11:29:27 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2018-04-27 12:55:51 +0100 |
commit | 2a13af23bc0561ab48e0a90528231c40ee209724 (patch) | |
tree | 55b806d5723d009cee8c9e925530dc5cedb1c37a /synapse/util/async.py | |
parent | Merge pull request #3134 from matrix-org/erikj/fix_admin_media_api (diff) | |
download | synapse-2a13af23bc0561ab48e0a90528231c40ee209724.tar.xz |
Use run_in_background in preference to preserve_fn
While I was going through uses of preserve_fn for other PRs, I converted places which only use the wrapped function once to use run_in_background, to avoid creating the function object.
Diffstat (limited to 'synapse/util/async.py')
-rw-r--r-- | synapse/util/async.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/util/async.py b/synapse/util/async.py index 0729bb2863..bd07067328 100644 --- a/synapse/util/async.py +++ b/synapse/util/async.py @@ -17,7 +17,7 @@ from twisted.internet import defer, reactor from .logcontext import ( - PreserveLoggingContext, make_deferred_yieldable, preserve_fn + PreserveLoggingContext, make_deferred_yieldable, run_in_background ) from synapse.util import logcontext, unwrapFirstError @@ -161,7 +161,7 @@ def concurrently_execute(func, args, limit): pass return logcontext.make_deferred_yieldable(defer.gatherResults([ - preserve_fn(_concurrently_execute_inner)() + run_in_background(_concurrently_execute_inner) for _ in xrange(limit) ], consumeErrors=True)).addErrback(unwrapFirstError) |