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): add WithMaxElapsedTime to retry options and refactor to use functional options #729

Merged
merged 2 commits into from
Jan 21, 2025

Conversation

matt-FFFFFF
Copy link
Member

@matt-FFFFFF matt-FFFFFF commented Jan 16, 2025

@jaredfholgate discovered an issue with long resource operations and retry.

The package we use has a default max elapsed time of 15m.

This causes an issue when the resource's timeout values were set to longer than 15m.

This PR adds the backoff.WithMaxElapsedTime() setting into the retry configuration. It sets this to the resource's timeout value. Since we use the context aware retry function in the backoff package this value just needs to be equal to or higher than the timeout value. Once the context deadline is exceeded then the retry package will exit anyway (we already have unit tests for this).

I have also refactored to remove the unnecessary NewRetryableErrors() function from the clients package. This was inflexible and using the functional options variadic pattern provided by the backoff package is much cleaner.

To support the conversion of []string to []regexp I have added a small function.

WDYT @ms-henglu ?

@matt-FFFFFF matt-FFFFFF marked this pull request as ready for review January 16, 2025 11:28
@ms-henglu ms-henglu self-requested a review January 17, 2025 01:57
Copy link
Member

@ms-henglu ms-henglu left a comment

Choose a reason for hiding this comment

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

LGTM

@ms-henglu
Copy link
Member

Thanks @matt-FFFFFF for this PR!

@ms-henglu ms-henglu merged commit f975629 into Azure:main Jan 21, 2025
10 checks passed
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.

2 participants