Skip to content
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

docs: update comments #1188

Merged
merged 2 commits into from Jan 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -32,28 +32,27 @@ public static void main(String[] args) {
}

static void deleteBlob(String bucketName, String blobName) {
// Update the retry settings
// Customize retry behavior
RetrySettings retrySettings =
StorageOptions.getDefaultRetrySettings()
.toBuilder()
// to set the max number of attempts to 10
// Set the max number of attempts to 10 (initial attempt plus 9 retries)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this part can just be "(default=1)" to show that the default number of attempts is 1.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The default number of attempts is 6, so that'd be 5 retries.

.setMaxAttempts(10)
// to set the backoff multiplier to 3.0
// Set the backoff multiplier to 3.0
.setRetryDelayMultiplier(3.0)
// to set the max duration of all attempts to 5 minutes
// Set the max duration of all attempts to 5 minutes
.setTotalTimeout(Duration.ofMinutes(5))
.build();

StorageOptions alwaysRetryStorageOptions =
StorageOptions.newBuilder()
// Configure our options so all requests will be retried even if they are
// non-idempotent.
// Customize retry so all requests are retried even if they are non-idempotent.
.setStorageRetryStrategy(StorageRetryStrategy.getUniformStorageRetryStrategy())
// provide the previously configured retrySettings
.setRetrySettings(retrySettings)
.build();

// Instantiate a client with our options
// Instantiate a client
Storage storage = alwaysRetryStorageOptions.getService();

// Delete the blob
Expand Down