Skip to content

Commit

Permalink
samples: added comments for timeout settings (#1355)
Browse files Browse the repository at this point in the history
  • Loading branch information
skuruppu committed May 7, 2021
1 parent d55770c commit ecaaf3b
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions samples/dml.js
Original file line number Diff line number Diff line change
Expand Up @@ -654,16 +654,29 @@ async function insertWithCustomTimeoutAndRetrySettings(
const UNAVAILABLE_STATUS_CODE = 14;
const retryAndTimeoutSettings = {
retry: {
// The set of error codes that will be retried.
retryCodes: [DEADLINE_EXCEEDED_STATUS_CODE, UNAVAILABLE_STATUS_CODE],
backoffSettings: {
// Configure retry delay settings.
// The initial amount of time to wait before retrying the request.
initialRetryDelayMillis: 500,
maxRetryDelayMillis: 64000,
// 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.
maxRetryDelayMillis: 10000,
// The previous wait time is multipled by this multiplier to come up
// with the next wait time, until the max is reached.
retryDelayMultiplier: 1.5,

// Configure RPC and total timeout settings.
initialRpcTimeoutMillis: 60000,
rpcTimeoutMultiplier: 1.0,
maxRpcTimeoutMillis: 60000,
// Timeout for the first RPC call. Subsequent retries will be based off
// this value.
initialRpcTimeoutMillis: 5000,
// Controls the change of timeout for each retry.
rpcTimeoutMultiplier: 1.5,
// The max for the per RPC timeout.
maxRpcTimeoutMillis: 30000,
// The timeout for all calls (first call + all retries).
totalTimeoutMillis: 60000,
},
},
Expand Down

0 comments on commit ecaaf3b

Please sign in to comment.