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

feat: add retry and timeout for batch dml #1107

Merged
merged 7 commits into from
Mar 6, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
feat(spanner): update comment
  • Loading branch information
harshachinta committed Mar 6, 2024
commit 66535e1db9035f1edc1b0b094427c7a4773ff8e0
12 changes: 7 additions & 5 deletions samples/samples/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -3029,16 +3029,18 @@ def set_custom_timeout_and_retry(instance_id, database_id):
instance = spanner_client.instance(instance_id)
database = instance.database(database_id)

# Customize retry with an initial wait time of 500 milliseconds.
# Customize retry with a maximum wait time of 16 seconds.
# Customize retry with a wait time multiplier per iteration of 1.5.
# Customize retry with a timeout on
# how long a certain RPC may be retried in case the server returns an error.
retry = retry.Retry(
harshachinta marked this conversation as resolved.
Show resolved Hide resolved
# Customize retry with an initial wait time of 500 milliseconds.
initial=0.5,
# Customize retry with a maximum wait time of 16 seconds.
maximum=16,
# Customize retry with a wait time multiplier per iteration of 1.5.
multiplier=1.5,
# Customize retry with a timeout on
# how long a certain RPC may be retried in
# case the server returns an error.
timeout=60,
# Configure which errors should be retried.
predicate=retry.if_exception_type(
core_exceptions.ServiceUnavailable,
harshachinta marked this conversation as resolved.
Show resolved Hide resolved
),
Expand Down