mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-09-20 22:04:36 -04:00
Fix TaskStopped exceptions when outbound requests time out (#4690)
This commit is contained in:
parent
8d98dc8ffe
commit
c88bc53903
4 changed files with 30 additions and 18 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue