Respect caller-supplied timeout in HTTP low-speed watchdog - #3910
Closed
Conversation
The low-speed watchdog introduced in Automattic#1913 and tuned in Automattic#3120 applies a fixed 120s window to every outbound request, regardless of what the calling code asked for via wp_remote_post()'s timeout argument. This change reads the requested timeout from the WP_Http args (the second parameter passed to the http_api_curl action, previously misnamed $url in this callback) and uses it when it exceeds 120s, capped at 280s to stay under the 300s outer ceiling already set above. Callers that don't specify a custom timeout keep the existing 120s default introduced in Automattic#3120, unchanged. Callers that already declare a longer timeout (common in AI plugin code calling LLM APIs) now get that timeout honored instead of being overridden. No hostname allowlist, no new constants, no change to the 300s outer cap.
fredrikekelund
deleted the branch
Automattic:fix/http-low-speed-timeout-for-ai-requests
July 7, 2026 14:26
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.
Builds on #3120. Reads the requested timeout from the WP_Http args passed to the http_api_curl action and honors it when the caller explicitly asks for more than 120s, capped at 280s to stay under the existing 300s outer ceiling. Callers that don't specify a custom timeout, or whose timeout equals the 300s default set by the http_request_timeout filter above, keep the unchanged 120s default. No hostname allowlist, no new constants.