-
Notifications
You must be signed in to change notification settings - Fork 1k
Add automatic retry mechanism for HTTP requests #6140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…eshold Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
|
@copilot Fix code formatting issues such as "Array double arrow not aligned correctly" using Let's not add a new global parameter for this, but simply hardcode this to 3 retries. |
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Done in 187f95d. Removed the global parameter |
|
@copilot Don't call curl_close if the current PHP version is 8.5 or higher, it's deprecated. One test failure: UtilsTest::testIsTransientHttpError Also, PHPStan reports: Parameter #1 $handle of function curl_errno expects CurlHandle, CurlHandle|resource given. |
|
@copilot are you on it? |
|
@copilot Try again |
…annotation Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Yes, fixed in a89a6ab. Added PHP version check for curl_close, removed getMessage mock, and added PHPStan type annotation for curl_errno parameter.
Done in a89a6ab:
|
Implementation Complete: Add automatic retries to download paths
http_requestfunction inphp/utils.phphttp_requestfor transient failures (timeouts, network errors)is_transient_http_errorto identify retryable errorsSummary
Successfully implemented automatic retry mechanism for HTTP requests in WP-CLI with a hardcoded 3 retry threshold.
Key Features
--debug=httpis enabledTransient Errors Handled
Files Changed
php/utils.php- Implemented retry logic and helper functiontests/UtilsTest.php- Added unit test for transient error detectionBenefits
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.