matrix-org / matrix-js-sdk

Matrix Client-Server SDK for JavaScript
Apache License 2.0
1.56k stars 583 forks source link

Increase uploadContent timeout #2974

Open CyberLeo opened 1 year ago

CyberLeo commented 1 year ago

The current MatrixHttpApi uploadContent implementation sets the timeout to 30 seconds, and refreshes the timeout every time there is a progress update. However, when connecting via Tor, large file uploads consistently time out.

Tor has large network buffers and ingests far more than the circuit is capable of transferring within 30 seconds. Progress updates end up being longer than 30 seconds apart, leading to an upload timeout.

As an example, when the timeout is raised to 300 seconds, a 25MB file upload progresses to 100% within 1 second, and then sits at 100% for the next two and a half minutes, before completing successfully. Without raising the timeout, the same file upload consistently fails after 31 seconds.

Please increase the uploadContent timeout from 30 seconds to 300 seconds, at least.

https://github.com/matrix-org/matrix-js-sdk/blob/develop/src/http-api/index.ts#L72 https://github.com/matrix-org/matrix-js-sdk/blob/develop/src/http-api/index.ts#L106

Thank you.

t3chguy commented 1 year ago

A PR to make it configurable would definitely be acceptable