-
-
Notifications
You must be signed in to change notification settings - Fork 508
Implement retry logic in HTTP Send method #5857
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
base: main
Are you sure you want to change the base?
Conversation
Added retry logic with exponential backoff to the Send method for HTTP requests, improving error handling and resilience against transient failures.
|
Thanks, but could you explain why this is necessary? |
In my actual usage, I found that every week some pipelines randomly fail to start due to HTTP request failures, possibly because the HTTP service is unstable. Therefore, retrying HTTP requests is necessary. |
|
You're using a config extension? |
Yes, my entire CI pipeline relies on External Configuration API |
|
Ok, so for backoffs we use |
Replaced manual backoff calculation with backoff package for retry logic.
ok , done |
Fix lint issues
|
Would it be possible to let the lib handle the waiting etc, so we don't need a for loop etc.? Similar to how this is done in https://github.com/woodpecker-ci/woodpecker/blob/main/cmd/server/server.go#L96-L104. |
Refactor HTTP request retry logic with backoff
done |
Removed initial backoff duration and maximum backoff interval constants from the Send function.
Removed unused error field from result type in HTTP utility. fix lint
|
Does it need result type at all, can't it just return int? |
Dear maintainers, if there are any details that still need to be adjusted, please feel free to make the changes directly. @qwerty287 @lafriks |
|
@lafriks changed that, do you want to check it out again? |
Added retry logic with exponential backoff to the Send method for HTTP requests, improving error handling and resilience against transient failures.