feat: default requests to a 30 second timeout - #540
Open
razor-x wants to merge 3 commits into
Open
Conversation
Requests had no timeout of their own and fell back to the Net::HTTP defaults, so a hung connection could block the caller far longer than the API would ever take to respond. Set the Faraday `timeout` and `open_timeout` to 30 seconds, matching the API's own request timeout, and add a `timeout` option so callers can raise or lower it. `faraday_options` still deep merges over the default, so either timeout can be set independently. The faraday_options spec asserted a timeout of 30, which is now also the default, so it moves to 45 to keep proving the merge. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMgDauUA2R9u2THCHmMgv1
A file per constant does not scale. default_endpoint.rb and default_timeout.rb become defaults.rb, which the new constants can join. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XMgDauUA2R9u2THCHmMgv1
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.
Part of a four-SDK change adding a default HTTP timeout (javascript-http, python, csharp).
Problem
Requests had no timeout of their own and fell back to the Net::HTTP defaults, so a hung connection could block the caller far longer than the API would ever take to respond.
Changes
timeoutandopen_timeoutto 30 seconds by default, matching the API's own request timeout.timeoutoption, in seconds, to the constructor and the factory methods onSeam,Seam::Http,SingleWorkspace, andMultiWorkspace.faraday_optionsstill deep merges over the default, so either timeout can be set independently.A single
timeout:sets both values on purpose. Setting only the read timeout would leave a hung TCP connect on Net::HTTP's 60 second default and undercut the point of the change.Behavior change
Requests that previously ran longer than 30 seconds will now raise
Faraday::TimeoutError. Thetimeoutoption is the opt-out.Testing
92 examples, 0 failures.
standardrbis clean.spec/seam_client/timeout_spec.rbis new. The existingfaraday_optionsspec asserted a timeout of30, which is now also the default and so no longer proved anything — it moves to45to keep testing the merge.Note for reviewers
Retries multiply the timeout. With the default of 2 retries, a fully hung endpoint is now bounded at roughly 90 seconds rather than far longer. Retry behavior is otherwise untouched here.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XMgDauUA2R9u2THCHmMgv1
Generated by Claude Code