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/file_consumer.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/file_consumer.py')
-rw-r--r-- | synapse/util/file_consumer.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/util/file_consumer.py b/synapse/util/file_consumer.py index 3c8a165331..3380970e4e 100644 --- a/synapse/util/file_consumer.py +++ b/synapse/util/file_consumer.py @@ -15,7 +15,7 @@ from twisted.internet import threads, reactor -from synapse.util.logcontext import make_deferred_yieldable, preserve_fn +from synapse.util.logcontext import make_deferred_yieldable, run_in_background from six.moves import queue @@ -70,7 +70,9 @@ class BackgroundFileConsumer(object): self._producer = producer self.streaming = streaming - self._finished_deferred = preserve_fn(threads.deferToThread)(self._writer) + self._finished_deferred = run_in_background( + threads.deferToThread, self._writer + ) if not streaming: self._producer.resumeProducing() |