Skip to content

Commit

Permalink
docs: update custom timeout and retry sample (#1174)
Browse files Browse the repository at this point in the history
Fixes a couple of minor issues in the retry- and timeout sample:

1. Remove DeadlineExceeded as a retryable code, as the sample uses a single timeout and will not retry on DeadlineExceeded anyways, meaning that the addition of that error code was just confusing.
1. Update the maxBackoff to 16 seconds. We are setting this value to 16 seconds for all client libraries, as it makes the sample confusing when the max backoff is larger than the total timeout (60 seconds).

The documentation page that uses this sample is https://cloud.google.com/spanner/docs/custom-timeout-and-retry

Do not merge: Please hold off on merging until all the samples have been updated.
  • Loading branch information
olavloite authored Sep 28, 2023
1 parent 37e6c13 commit f8fbb4e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spanner/spanner_samples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2353,9 +2353,9 @@ def set_custom_timeout_and_retry project_id:, instance_id:, database_id:
timeout = 60.0
retry_policy = {
initial_delay: 0.5,
max_delay: 64.0,
max_delay: 16.0,
multiplier: 1.5,
retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
retry_codes: ["UNAVAILABLE"]
}
call_options = { timeout: timeout, retry_policy: retry_policy }

Expand Down

0 comments on commit f8fbb4e

Please sign in to comment.