Skip to content

Add timeout option to the Rust HTTP client#19534

Draft
MadLittleMods wants to merge 3 commits intodevelopfrom
madlittlemods/timeout-rust-http-client
Draft

Add timeout option to the Rust HTTP client#19534
MadLittleMods wants to merge 3 commits intodevelopfrom
madlittlemods/timeout-rust-http-client

Conversation

@MadLittleMods
Copy link
Contributor

@MadLittleMods MadLittleMods commented Mar 6, 2026

Add timeout option to the Rust HTTP client

Part of https://github.com/element-hq/synapse-rust-apps/issues/456 (want to add a timeout for the Synapse module side of the Synapse Pro Event Cache)

This is a breaking change in the Rust HTTP client which doesn't really matter because we don't expose it in the Module API. We do rely on it in the Synapse Pro Event Cache module but that's our problem.

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct (run the linters)

There is no timeout.

In Synapse, we're using the `async_impl` of `reqwest` which says ["Default is no timeout"](https://github.com/seanmonstar/reqwest/blob/fa74a8b835b2f194253cebdab8d049c0e5d23af3/src/async_impl/client.rs#L1429-L1438).

`reqwest` does have a 30 second default timeout but only for the `blocking` client (["Default is 30 seconds."](https://github.com/seanmonstar/reqwest/blob/fa74a8b835b2f194253cebdab8d049c0e5d23af3/src/blocking/client.rs#L383-L394), [source](https://github.com/seanmonstar/reqwest/blob/fa74a8b835b2f194253cebdab8d049c0e5d23af3/src/blocking/client.rs#L1496-L1504))

> A default timeout for `reqwest::Client` is used set to 30 seconds (#181)
>
> *-- [`seanmonstar/reqwest` -> `CHANGELOG.md#v080`](https://github.com/seanmonstar/reqwest/blob/fa74a8b835b2f194253cebdab8d049c0e5d23af3/CHANGELOG.md#v080)*

(tracked by seanmonstar/reqwest#181, added in seanmonstar/reqwest#195)

I've also tested this locally and can confirm the Synapse Rust HTTP client doesn't have any timeout at the moment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant