diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2019-02-20 11:35:52 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-20 11:35:52 +0000 |
commit | c88bc5390341162951fa4afc6b4a0644a30293dc (patch) | |
tree | 95ac52940edc6aa6df57aee735392521aaf7acb3 /synapse/http/matrixfederationclient.py | |
parent | Clean up gitignores (#4688) (diff) | |
download | synapse-c88bc5390341162951fa4afc6b4a0644a30293dc.tar.xz |
Fix TaskStopped exceptions when outbound requests time out (#4690)
Diffstat (limited to '')
-rw-r--r-- | synapse/http/matrixfederationclient.py | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/synapse/http/matrixfederationclient.py b/synapse/http/matrixfederationclient.py index 3c24bf3805..1682c9af13 100644 --- a/synapse/http/matrixfederationclient.py +++ b/synapse/http/matrixfederationclient.py @@ -28,11 +28,10 @@ from canonicaljson import encode_canonical_json from prometheus_client import Counter from signedjson.sign import sign_json -from twisted.internet import defer, protocol, task +from twisted.internet import defer, protocol from twisted.internet.error import DNSLookupError from twisted.internet.task import _EPSILON, Cooperator from twisted.web._newclient import ResponseDone -from twisted.web.client import FileBodyProducer from twisted.web.http_headers import Headers import synapse.metrics @@ -44,6 +43,7 @@ from synapse.api.errors import ( RequestSendFailed, SynapseError, ) +from synapse.http import QuieterFileBodyProducer from synapse.http.federation.matrix_federation_agent import MatrixFederationAgent from synapse.util.async_helpers import timeout_deferred from synapse.util.logcontext import make_deferred_yieldable @@ -839,16 +839,3 @@ def encode_query_args(args): query_bytes = urllib.parse.urlencode(encoded_args, True) return query_bytes.encode('utf8') - - -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 |