Skip to content

Commit 9313879

Browse files
authored
samples: update retry sample and comments (#1485)
1 parent 29d823d commit 9313879

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

samples/snippets/storage_configure_retries.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,15 @@ def configure_retries(bucket_name, blob_name):
3838
bucket = storage_client.bucket(bucket_name)
3939
blob = bucket.blob(blob_name)
4040

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

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

0 commit comments

Comments
 (0)