Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions samples/snippets/storage_configure_retries.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,15 @@ def configure_retries(bucket_name, blob_name):
bucket = storage_client.bucket(bucket_name)
blob = bucket.blob(blob_name)

# Customize retry with a deadline of 500 seconds (default=120 seconds).
modified_retry = DEFAULT_RETRY.with_deadline(500.0)
# Customize retry with a timeout of 500 seconds (default=120 seconds).
modified_retry = DEFAULT_RETRY.with_timeout(500.0)
# Customize retry with an initial wait time of 1.5 (default=1.0).
# Customize retry with a wait time multiplier per iteration of 1.2 (default=2.0).
# Customize retry with a maximum wait time of 45.0 (default=60.0).
modified_retry = modified_retry.with_delay(initial=1.5, multiplier=1.2, maximum=45.0)

# blob.delete() uses DEFAULT_RETRY_IF_GENERATION_SPECIFIED by default.
# Override with modified_retry so the function retries even if the generation
# number is not specified.
# blob.delete() uses DEFAULT_RETRY by default.
# Pass in modified_retry to override the default retry behavior.
print(
f"The following library method is customized to be retried according to the following configurations: {modified_retry}"
)
Expand Down