-
Notifications
You must be signed in to change notification settings - Fork 2
feat: retry option added in gcp upload #40
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
@google-cloud/storage version 7 retryOptions configuration fields and structure💡 Result:
In
@google-cloud/storage(Node.js) v7, the retry configuration is provided via the Storage constructor option retryOptions (a plain object). Its fields include (with the structure shown below): 1) autoRetry (boolean) - Whether requests are automatically retried. If false, requests will not retry and the other parameters below will not affect retry behavior. [1] 2) retryDelayMultiplier (number) - Multiplier for increasing delay between completion of failed requests and initiation of subsequent retries. [1] 3) totalTimeout (number) - Total time (from initial request sent to a timeout). After timeout, an error is returned regardless of any retry attempts during that period. [1] 4) maxRetryDelay (number) - Maximum delay time between requests; when reached, retryDelayMultiplier is no longer used to increase delay time. [1] 5) maxRetries (number) - Maximum number of automatic retries attempted before returning the error. [1] 6) idempotencyStrategy (IdempotencyStrategy) - Strategy controlling idempotency-based retry behavior; the docs example uses IdempotencyStrategy.RetryAlways. [1] Example structure (as shown in Google’s Cloud Storage retry sample): const {Storage} = require('@google-cloud/storage'); const storage = new Storage({ retryOptions: { autoRetry: true, retryDelayMultiplier: 3, totalTimeout: 500, maxRetryDelay: 60, maxRetries: 5, idempotencyStrategy: IdempotencyStrategy.RetryAlways, }, }); [1] Additional context on where this config plugs in: - When you initialize Cloud Storage, a retryOptions config file is initialized as well; unless overridden, options in the config are set to default values. To modify default behavior, pass retryOptions into the storage constructor upon initialization. [2] IdempotencyStrategy values (used by idempotencyStrategy): - RetryAlways, RetryConditional, RetryNever. [3] Notes / scope - The fields above are the ones explicitly documented in Google’s v7-era Node.js Cloud Storage retry configuration sample and the related reference pages. [1][2]Citations:
🏁 Script executed:
Repository: CloudStuffTech/tracker-utils
Length of output: 671
Correct units in retry configuration: use milliseconds, not seconds.
Field names are correct for v7, but the code has a critical unit error:
totalTimeout: 300with comment "seconds" will actually timeout after 300 milliseconds (0.3 seconds), not 5 minutes as likely intended. Should betotalTimeout: 300000for 300 seconds.maxRetryDelay: 60with comment "seconds" will cap retries at 60 milliseconds, not 60 seconds. Should bemaxRetryDelay: 60000for 60 seconds.Additionally, the v7 API example includes
idempotencyStrategy: IdempotencyStrategy.RetryAlwaysin the retryOptions, which should be added here. This requires importingIdempotencyStrategyfrom@google-cloud/storage.🤖 Prompt for AI Agents