summary refs log tree commit diff
path: root/synapse/http/__init__.py
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2019-02-20 14:15:56 +0000
committerRichard van der Hoff <richard@matrix.org>2019-02-20 14:15:56 +0000
commit4da63d9f6fc404b00d8c39b200f9f67c29d5dfa9 (patch)
tree43ac96a5b91bbc498228f44798cdc260de1f47c0 /synapse/http/__init__.py
parentApply the pusher http hack in the right place (#4692) (diff)
parentLogging improvements for the pusher (#4691) (diff)
downloadsynapse-4da63d9f6fc404b00d8c39b200f9f67c29d5dfa9.tar.xz
Merge branch 'develop' into matrix-org-hotfixes
Diffstat (limited to 'synapse/http/__init__.py')
-rw-r--r--synapse/http/__init__.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/synapse/http/__init__.py b/synapse/http/__init__.py

index a3f9e4f67c..d36bcd6336 100644 --- a/synapse/http/__init__.py +++ b/synapse/http/__init__.py
@@ -15,8 +15,10 @@ # limitations under the License. import re +from twisted.internet import task from twisted.internet.defer import CancelledError from twisted.python import failure +from twisted.web.client import FileBodyProducer from synapse.api.errors import SynapseError @@ -47,3 +49,16 @@ def redact_uri(uri): r'\1<redacted>\3', uri ) + + +class QuieterFileBodyProducer(FileBodyProducer): + """Wrapper for FileBodyProducer that avoids CRITICAL errors when the connection drops. + + Workaround for https://github.com/matrix-org/synapse/issues/4003 / + https://twistedmatrix.com/trac/ticket/6528 + """ + def stopProducing(self): + try: + FileBodyProducer.stopProducing(self) + except task.TaskStopped: + pass