Skip to content

fix: only retry 5xx Cloud SQL Admin API errors #375

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

Merged
merged 3 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
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
37 changes: 29 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion src/sqladmin-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,20 @@ const defaultGaxiosHttpMethodsToRetry = [
function setupGaxiosConfig() {
gaxios.defaults = {
retryConfig: {
retry: 3,
retry: 5,
// Make sure to add POST to the list of default methods to retry
// since it's used in IAM generateAccessToken requests that needs retry
httpMethodsToRetry: ['POST', ...defaultGaxiosHttpMethodsToRetry],
// Should retry on non-http error codes such as ECONNRESET, ETIMEOUT, etc
noResponseRetries: 3,
// Defaults to: [[100, 199], [408, 408], [429, 429], [500, 599]]
statusCodesToRetry: [[500, 599]],
// The amount of time to initially delay the retry, in ms. Defaults to 100ms.
retryDelay: 200,
// The multiplier by which to increase the delay time between the
// completion of failed requests, and the initiation of the subsequent
// retrying request. Defaults to 2.
retryDelayMultiplier: 1.618,
},
};
}
Expand Down