Skip to content

Conversation

@myselfghost
Copy link

Added retry logic with exponential backoff to the Send method for HTTP requests, improving error handling and resilience against transient failures.

Added retry logic with exponential backoff to the Send method for HTTP requests, improving error handling and resilience against transient failures.
@qwerty287
Copy link
Contributor

Thanks, but could you explain why this is necessary?

@myselfghost
Copy link
Author

myselfghost commented Dec 14, 2025

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.

@qwerty287
Copy link
Contributor

You're using a config extension?

@myselfghost
Copy link
Author

You're using a config extension?

Yes, my entire CI pipeline relies on External Configuration API

@qwerty287
Copy link
Contributor

Ok, so for backoffs we use github.com/cenkalti/backoff/v5. Can you use it?

Replaced manual backoff calculation with backoff package for retry logic.
@myselfghost
Copy link
Author

Ok, so for backoffs we use github.com/cenkalti/backoff/v5. Can you use it?

ok , done

Fix lint issues
@qwerty287
Copy link
Contributor

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.

@qwerty287 qwerty287 added the enhancement improve existing features label Dec 19, 2025
Refactor HTTP request retry logic with backoff
@myselfghost
Copy link
Author

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.

done

qwerty287 and others added 4 commits December 20, 2025 09:11
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
@lafriks
Copy link
Contributor

lafriks commented Dec 20, 2025

Does it need result type at all, can't it just return int?

@myselfghost
Copy link
Author

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

@qwerty287
Copy link
Contributor

@lafriks changed that, do you want to check it out again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement improve existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants