mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 18:44:51 -04:00
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.
This commit is contained in:
parent
0ced8b5b47
commit
2a13af23bc
22 changed files with 97 additions and 71 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue