From ececd70f9dddc2b40b594af052f82b6396975c5b Mon Sep 17 00:00:00 2001 From: Jayden Bailey Date: Thu, 9 Jul 2026 15:25:03 +0100 Subject: [PATCH 1/2] fix(storage): correctly use global retryStrategy if defined --- Storage/src/Connection/Rest.php | 3 ++- Storage/tests/Unit/StorageClientTest.php | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Storage/src/Connection/Rest.php b/Storage/src/Connection/Rest.php index 02acc0867fd2..4052e0875131 100644 --- a/Storage/src/Connection/Rest.php +++ b/Storage/src/Connection/Rest.php @@ -1020,6 +1020,8 @@ public function send($resource, $method, array $options = [], $whitelisted = fal ]; $retryResource = isset($retryMap[$resource]) ? $retryMap[$resource] : $resource; + $options['retryStrategy'] ??= $this->retryStrategy; + $options['restRetryFunction'] = $this->restRetryFunction ?? $this->getRestRetryFunction( $retryResource, $method, @@ -1027,7 +1029,6 @@ public function send($resource, $method, array $options = [], $whitelisted = fal ); $options += array_filter([ - 'retryStrategy' => $this->retryStrategy, 'restDelayFunction' => $this->restDelayFunction, 'restCalcDelayFunction' => $this->restCalcDelayFunction, 'restRetryListener' => $this->restRetryListener, diff --git a/Storage/tests/Unit/StorageClientTest.php b/Storage/tests/Unit/StorageClientTest.php index 9fc8c7bf6892..84b1e007c3fd 100644 --- a/Storage/tests/Unit/StorageClientTest.php +++ b/Storage/tests/Unit/StorageClientTest.php @@ -612,12 +612,12 @@ public function testDefaultRetryStrategyFailing() $client->createBucket('myBucket'); } - public static function getCreateBucketSuccessResponse() + public static function getCreateHmacKeySuccessResponse() { return new Response( 200, ['Content-Type' => 'application/json'], - json_encode(['name' => 'myBucket']) + json_encode(['secret' => 'foo', 'metadata' => ['accessId' => 'test']]) ); } @@ -625,7 +625,7 @@ public function testAlwaysRetryStrategySuccessful() { $httpHandler = self::getHttpHandlerMock([ new Response(503), // Service Unavailable - self::getCreateBucketSuccessResponse(), + self::getCreateHmacKeySuccessResponse(), ])[1]; $client = new StorageClient([ @@ -642,7 +642,8 @@ public function testAlwaysRetryStrategySuccessful() }, ]); - $this->assertInstanceOf(Bucket::class, $client->createBucket('myBucket')); + // Test using an operation that is not idempotent + $this->assertInstanceOf(CreatedHmacKey::class, $client->createHmacKey('test@example.com')); } public function testDelayFunctionsConfiguration() From 36b77f2563215ecb77d66cc66ed1004dfd26a1e1 Mon Sep 17 00:00:00 2001 From: Jayden Bailey Date: Wed, 22 Jul 2026 01:27:34 +0100 Subject: [PATCH 2/2] fix retry strategy logic for Rest::headObject too --- Storage/src/Connection/Rest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Storage/src/Connection/Rest.php b/Storage/src/Connection/Rest.php index 4052e0875131..876e9e5665c0 100644 --- a/Storage/src/Connection/Rest.php +++ b/Storage/src/Connection/Rest.php @@ -317,6 +317,8 @@ public function headObject(array $args = []): array 'prettyPrint' => false, ]; + $args['retryStrategy'] ??= $this->retryStrategy; + $args['restRetryFunction'] = $this->restRetryFunction ?? $this->getRestRetryFunction( 'objects', 'get', @@ -324,7 +326,6 @@ public function headObject(array $args = []): array ); $args += array_filter([ - 'retryStrategy' => $this->retryStrategy, 'restDelayFunction' => $this->restDelayFunction, 'restCalcDelayFunction' => $this->restCalcDelayFunction, 'restRetryListener' => $this->restRetryListener,