File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1+ Speed up responding to media requests.
Original file line number Diff line number Diff line change 5050from synapse .api .errors import Codes , cs_error
5151from synapse .http .server import finish_request , respond_with_json
5252from synapse .http .site import SynapseRequest
53- from synapse .logging .context import defer_to_thread , make_deferred_yieldable
53+ from synapse .logging .context import (
54+ defer_to_thread ,
55+ make_deferred_yieldable ,
56+ run_in_background ,
57+ )
5458from synapse .types import ISynapseReactor
5559from synapse .util import Clock
5660from synapse .util .stringutils import is_ascii
@@ -657,7 +661,7 @@ def beginFileTransfer(
657661
658662 # We set the wakeup signal as we should start producing immediately.
659663 self .wakeup_event .set ()
660- defer_to_thread ( self .reactor , self ._on_thread_read_loop )
664+ run_in_background ( defer_to_thread , self .reactor , self ._on_thread_read_loop )
661665
662666 return make_deferred_yieldable (self .deferred )
663667
@@ -672,6 +676,9 @@ def pauseProducing(self) -> None:
672676 def stopProducing (self ) -> None :
673677 """interfaces.IPushProducer"""
674678
679+ # Unregister the consumer so we don't try and interact with it again.
680+ self .consumer = None
681+
675682 # Terminate the thread loop.
676683 self .wakeup_event .set ()
677684 self .stop_event .set ()
You can’t perform that action at this time.
0 commit comments