Repository navigation
Conversation
HttpClient#request calls HTTParty without a timeout, so a stalled response holds the calling thread for Net::HTTP's default 60s read timeout. Add optional open_timeout and read_timeout to Context.setup and pass them to HTTParty on every request. Unset, behaviour is unchanged. Fixes Shopify#1466 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Author
|
I have signed the CLA! |
This branch has not been deployed
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.
Description
Fixes #1466
HttpClient#requestcalls HTTParty with no timeout, so every API request uses Net::HTTP's default 60-second read timeout. When Shopify is slow to respond, the calling thread (often a web request worker) waits for the whole stall. In production we saw an Admin GraphQL read hold a Puma thread for 27.5s.open_timeoutandread_timeout(seconds) toShopifyAPI::Context.setup.HttpClient#requestpasses the ones that are set to HTTParty.Net::OpenTimeout/Net::ReadTimeout. The retry loop only retries 429/500 responses, so timeouts aren't retried; the README says so.This is deliberately narrower than #1376, which exposes a general
httparty_paramshash. Only the two timeouts are added, as typed settings. If you'd rather take #1376, it covers this as well.How has this been tested?
test/clients/http_client_test.rb:Contextreach the Net::HTTP connection;Net::ReadTimeoutis raised and not retried.test/context_test.rb: both settings default toniland can be configured.bundle exec rake test:library: 347 runs, 0 failures.rubocopandsrb tcare clean.http_client_testtest fails when**timeoutsis removed from the HTTParty call.Checklist:
🤖 Generated with Claude Code