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

fix: edit timeout and retry logic #1100

Merged
merged 3 commits into from
Sep 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/gax.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,32 @@ export class CallSettings {
let longrunning = this.longrunning;
let apiName = this.apiName;
let retryRequestOptions = this.retryRequestOptions;
// If a method-specific timeout is set in the service config, and the retry codes for that
// method are non-null, then that timeout value will be used to
// override backoff settings.
if (
retry !== undefined &&
retry !== null &&
retry.retryCodes !== null &&
retry.retryCodes.length > 0
) {
retry.backoffSettings.initialRpcTimeoutMillis = timeout;
retry.backoffSettings.maxRpcTimeoutMillis = timeout;
retry.backoffSettings.totalTimeoutMillis = timeout;
}
// If the user provides a timeout to the method, that timeout value will be used
// to override the backoff settings.
if ('timeout' in options) {
timeout = options.timeout!;
if (
retry !== undefined &&
retry !== null &&
retry.retryCodes.length > 0
) {
retry.backoffSettings.initialRpcTimeoutMillis = timeout;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you confirm from the design doc. If a user provide timeout and retry.backoffSetting, we are repect the retry setting.

retry.backoffSettings.maxRpcTimeoutMillis = timeout;
retry.backoffSettings.totalTimeoutMillis = timeout;
}
}
if ('retry' in options) {
retry = mergeRetryOptions(retry || ({} as RetryOptions), options.retry!);
Expand Down