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

docs: document retry settings in sample #1214

Merged
merged 2 commits into from May 26, 2021
Merged
Changes from all commits
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
Expand Up @@ -53,14 +53,23 @@ static void executeSqlWithCustomTimeoutAndRetrySettings(
.setRetrySettings(
RetrySettings.newBuilder()
// Configure retry delay settings.
// The initial amount of time to wait before retrying the request.
.setInitialRetryDelay(Duration.ofMillis(500))
// The maximum amount of time to wait before retrying. I.e. after this value is
// reached, the wait time will not increase further by the multiplier.
.setMaxRetryDelay(Duration.ofSeconds(64))
// The previous wait time is multiplied by this multiplier to come up with the next
// wait time, until the max is reached.
.setRetryDelayMultiplier(1.5)

// Configure RPC and total timeout settings.
// Timeout for the first RPC call. Subsequent retries will be based off this value.
hengfengli marked this conversation as resolved.
Show resolved Hide resolved
.setInitialRpcTimeout(Duration.ofSeconds(60))
// The max for the per RPC timeout.
.setMaxRpcTimeout(Duration.ofSeconds(60))
// Controls the change of timeout for each retry.
.setRpcTimeoutMultiplier(1.0)
// The timeout for all calls (first call + all retries).
.setTotalTimeout(Duration.ofSeconds(60))
.build());
// Create a Spanner client using the custom retry and timeout settings.
Expand Down