Skip to content

feat: add configurable request and connection timeouts#30

Open
Onyx2406 wants to merge 2 commits into
interledger:mainfrom
Onyx2406:feat/configurable-timeouts
Open

feat: add configurable request and connection timeouts#30
Onyx2406 wants to merge 2 commits into
interledger:mainfrom
Onyx2406:feat/configurable-timeouts

Conversation

@Onyx2406
Copy link
Copy Markdown

@Onyx2406 Onyx2406 commented Apr 3, 2026

Summary

Adds optional request_timeout and connect_timeout fields to ClientConfig.

Problem: The authenticated client creates a bare reqwest::Client::new() with no timeouts. In production, a payment API call with no timeout will hang indefinitely if the server stops responding — a safety concern for any financial API client.

Solution:

  • request_timeout: Option<Duration> — overall request timeout (default: 30s via ClientConfig::default())
  • connect_timeout: Option<Duration> — TCP connection timeout (default: 10s via ClientConfig::default())
  • Set to None to disable timeouts

The fields use #[serde(skip)] since Duration doesn't implement Serialize/Deserialize and timeouts are typically set programmatically, not via config files.

Test plan

  • All 16 unit tests pass
  • All 10 client request tests pass
  • All 19 type roundtrip tests pass

Onyx2406 added 2 commits April 3, 2026 07:46
Add optional request_timeout and connect_timeout fields to
ClientConfig. A payment API client without timeouts can hang
indefinitely if the server stops responding, which is a
production safety concern.

Defaults to 30s request timeout and 10s connection timeout via
ClientConfig::default(). Can be set to None to disable timeouts.
- Add test verifying client builds and works with custom timeouts
- Add test verifying default config has 30s request / 10s connect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant