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: retry 50x errors with exponential backoff #781

Merged
merged 1 commit into from
Apr 30, 2024
Merged

fix: retry 50x errors with exponential backoff #781

merged 1 commit into from
Apr 30, 2024

Conversation

enocom
Copy link
Member

@enocom enocom commented Apr 29, 2024

This commit adds retry behavior to the two SQL Admin API calls. Any response that results in a 50x error will now be retried up to 5 times with exponential backoff and jitter between each attempt.

The formula used to calculate the duration to wait is:

200ms * 1.618^(attempt + jitter)

This calculation matches what the Cloud SQL Proxy v1 does and will not trigger any significant change in load on the backend.

Fixes #718

This commit adds retry behavior to the two SQL Admin API calls. Any
response that results in a 50x error will now be retried up to 5 times
with exponential backoff and jitter between each attempt.

The formula used to calculate the duration to wait is:

200ms * 1.618^(attempt + jitter)

This calculation matches what the Cloud SQL Proxy v1 does and will not
trigger any significant change in load on the backend.
@enocom enocom requested a review from a team as a code owner April 29, 2024 15:52
@enocom
Copy link
Member Author

enocom commented Apr 29, 2024

Copy link
Collaborator

@jackwotherspoon jackwotherspoon left a comment

Choose a reason for hiding this comment

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

LGTM ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Failed to get instance metadata" error while connection to CloudSQL
2 participants