fix: give every default HTTP client a connect/total timeout - #98
Open
zaoldyeck wants to merge 1 commit into
Open
fix: give every default HTTP client a connect/total timeout#98zaoldyeck wants to merge 1 commit into
zaoldyeck wants to merge 1 commit into
Conversation
reqwest's Client has no timeout by default, so one hung TCP connection (a dropped SYN-ACK, a stalled proxy) wedges the calling task forever — no error, no return. All four sub-clients (clob/gamma/data/bridge) built their default client without one. 10s connect / 30s total: far above any healthy response from these APIs, while guaranteeing the caller always gets control back. Callers that need different budgets can keep constructing their own client.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
reqwest::Clientships with no timeout by default, and all four sub-clients (clob / gamma / data / bridge) build their default client without setting one. A single hung TCP connection — a dropped SYN-ACK, a stalled middlebox — wedges the calling task forever: no error, no return. We measured exactly this failure class live (a task hung 17+ minutes on a network blip until externally killed).Fix
connect_timeout(10s)+timeout(30s)on the default builders. Both are far above any healthy response from these APIs, while guaranteeing the caller always gets control back. Callers with different budgets can keep constructing and injecting their own client, as before.🤖 Generated with Claude Code
https://claude.ai/code/session_01CRy5VdMgLHQ1EB9WgqxP3p
Note
Medium Risk
Default timeouts apply to all four API surfaces, including CLOB; legitimately slow calls may now surface timeout errors instead of hanging, which can affect trading and automation that relied on unbounded waits.
Overview
Adds 10s connect and 30s total request timeouts on the built-in
reqwestclients in bridge, clob, data, and gammaClient::new, so hung connections fail instead of blocking forever.Each builder gets a short comment explaining why
reqwesthas no default timeout. Callers who need different limits can still supply their own HTTP client where the API allows it.Reviewed by Cursor Bugbot for commit 91c9257. Bugbot is set up for automated code reviews on this repo. Configure here.