Skip to content

fix(storage): correctly use global retryStrategy if defined - #9335

Open
jayktaylor wants to merge 2 commits into
googleapis:mainfrom
jayktaylor:fix/storage-retryStrategy
Open

fix(storage): correctly use global retryStrategy if defined#9335
jayktaylor wants to merge 2 commits into
googleapis:mainfrom
jayktaylor:fix/storage-retryStrategy

Conversation

@jayktaylor

Copy link
Copy Markdown

fixes #9334

@jayktaylor
jayktaylor requested review from a team as code owners July 9, 2026 14:30
@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Jul 9, 2026

@cy-yun cy-yun left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic of the fix here is sound, and changing the test to use createHmacKey (which isn't idempotent) correctly verifies that the global config is now being honored.

However, I noticed that the exact same bug is still present in Rest::headObject() (around line 320 in Storage/src/Connection/Rest.php).

In headObject(), $this->getRestRetryFunction() is being called before retryStrategy gets merged into the array:

        $args['restRetryFunction'] = $this->restRetryFunction ?? $this->getRestRetryFunction(
            'objects',
            'get',
            $args
        );

        $args += array_filter([
            'retryStrategy' => $this->retryStrategy, // <--- Too late!
            'restDelayFunction' => $this->restDelayFunction,
            // ...
        ]);

Could you apply the exact same fix to headObject() as well?

        $args['retryStrategy'] ??= $this->retryStrategy;

        $args['restRetryFunction'] = $this->restRetryFunction ?? $this->getRestRetryFunction(
            'objects',
            'get',
            $args
        );

        $args += array_filter([
            'restDelayFunction' => $this->restDelayFunction,
            // ...

I'll be happy to approve once that spot is updated as well. Thanks for working on this!

@jayktaylor

Copy link
Copy Markdown
Author

@cy-yun thanks for looking over this! Good spot - I hadn't noticed that but it should be fixed now. From a quick look elsewhere in the library, I think there shouldn't be anything else that has the exact same problem.

@jayktaylor
jayktaylor force-pushed the fix/storage-retryStrategy branch from 36b77f2 to 3af2a7f Compare August 4, 2026 23:29
@jayktaylor
jayktaylor force-pushed the fix/storage-retryStrategy branch from 3af2a7f to 6c7f8af Compare August 27, 2026 21:51
@jayktaylor

Copy link
Copy Markdown
Author

Hey @cy-yun and co, is it possible to get this merged? Been waiting on this to be fixed upstream for one of our projects for a while :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StorageClient::send does not use the client's retryStrategy correctly

3 participants