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

feat(exp): add retry package #479

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

jooola
Copy link
Member

@jooola jooola commented Jul 9, 2024

Adds a few retry utilities that may be used in certain context to retry failed requests based on a policy.

Related to #470

@jooola jooola requested a review from a team as a code owner July 9, 2024 17:37
Copy link

codecov bot commented Jul 9, 2024

Codecov Report

Attention: Patch coverage is 90.47619% with 2 lines in your changes missing coverage. Please review.

Project coverage is 71.65%. Comparing base (756f605) to head (ac6a961).

Files Patch % Lines
hcloud/exp/retryutils/retry.go 89.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #479      +/-   ##
==========================================
+ Coverage   71.56%   71.65%   +0.08%     
==========================================
  Files          45       46       +1     
  Lines        3904     3923      +19     
==========================================
+ Hits         2794     2811      +17     
- Misses        696      698       +2     
  Partials      414      414              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@apricote apricote left a comment

Choose a reason for hiding this comment

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

Do you have an example PR in any integration that uses this?

Policy func(err error) bool
}

func Retry[T any](opts Opts, request func() (T, *hcloud.Response, error)) (T, *hcloud.Response, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you add examples for these to showcase how one can use them?

Copy link
Member Author

Choose a reason for hiding this comment

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

Haha, I would love to, but:

Let's wait until we find a use case that we can implement and test against.

@jooola jooola marked this pull request as draft July 15, 2024 15:14
@jooola jooola force-pushed the retryutils branch 2 times, most recently from ac6a961 to 2fc0a6d Compare July 23, 2024 08:18
Copy link
Contributor

github-actions bot commented Nov 8, 2024

This PR has been marked as stale because it has not had recent activity. The bot will close the PR if no further action occurs.

@github-actions github-actions bot added the stale label Nov 8, 2024
@jooola jooola added pinned and removed stale labels Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants