From f8fbb4e03c4486ac491e719912ba0cda231c4c45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Olav=20L=C3=B8ite?= Date: Thu, 28 Sep 2023 08:24:34 +0200 Subject: [PATCH] docs: update custom timeout and retry sample (#1174) 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. --- spanner/spanner_samples.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spanner/spanner_samples.rb b/spanner/spanner_samples.rb index d78c60fba..d4637d7d7 100644 --- a/spanner/spanner_samples.rb +++ b/spanner/spanner_samples.rb @@ -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 }