Skip to content

Commit e9cc891

Browse files
Copilotswissspidy
andcommitted
Fix debug message to show clearer retry numbers and update PHPDoc
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent 47cc5b6 commit e9cc891

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

php/utils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ function http_request( $method, $url, $data = null, $headers = [], $options = []
969969

970970
// Store exception and retry.
971971
$last_exception = $exception;
972-
WP_CLI::debug( sprintf( 'Retrying HTTP request to %s (attempt %d/%d) after transient error: %s', $url, $attempt, $max_retries + 1, $exception->getMessage() ), 'http' );
972+
WP_CLI::debug( sprintf( 'Retrying HTTP request to %s (retry %d/%d) after transient error: %s', $url, $attempt - 1, $max_retries, $exception->getMessage() ), 'http' );
973973
sleep( $retry_after_delay );
974974
$retry_after_delay = min( $retry_after_delay * 2, 10 ); // Exponential backoff, max 10 seconds.
975975
continue;

tests/UtilsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,8 +1145,8 @@ public function testIsTransientHttpError(): void {
11451145
/**
11461146
* Create a mock Requests exception.
11471147
*
1148-
* @param string $type Exception type.
1149-
* @param \CurlHandle $curl_handle Curl handle.
1148+
* @param string $type Exception type.
1149+
* @param \CurlHandle|resource $curl_handle Curl handle (resource in PHP < 8.0, object in PHP >= 8.0).
11501150
* @return \WpOrg\Requests\Exception Mock exception.
11511151
*/
11521152
private function createMockRequestsException( $type, $curl_handle ) {

0 commit comments

Comments
 (0)