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: implement retry strategies ♻️ #6

Merged
merged 1 commit into from
Feb 29, 2024
Merged

Conversation

robertrossmann
Copy link
Member

@robertrossmann robertrossmann commented Feb 27, 2024

Now the task can be set up to retry on failure. By default, we only make a single execution attempt.

The retry mechanism is implemented in https://github.com/kamilsk/retry/v5 . I chose this package over https://github.com/eapache/go-resiliency because retry has a much more flexible API, provides a ton of strategies and backoff algorithms and the strategies are nicely defined via an interface, making extensions and customisations very easy.

Unfortunately, the last update to retry was in February 2021 so I might yet regret this decision but for the time being I feel like this is the superior choice over go-resiliency.

This partially implements #5. More work is still needed to incorporate all features from that pull request, namely being able to cancel long-running tasks.

@robertrossmann robertrossmann self-assigned this Feb 27, 2024
@robertrossmann robertrossmann added the enhancement New feature or request label Feb 27, 2024
@robertrossmann robertrossmann requested a review from a team February 27, 2024 23:10
Base automatically changed from feat/new-manager-with-options to master February 28, 2024 19:36
Now the task can be set up to retry on failure. By default, we only make a single execution attempt.

The retry mechanism is implemented in github.com/kamilsk/retry/v5 . I chose this package over https://github.com/eapache/go-resiliency because `retry` has a much more flexible API, provides a ton of strategies and backoff algorithms and the strategies are nicely defined via an interface, making extensions and customisations very easy.

Unfortunately, the last update to `retry` was in February 2021 so I might yet regret this decision but for the time being I feel like this is the superior choice over `go-resiliency`.
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (026eb05) to head (14a4f2b).

Additional details and impacted files
@@            Coverage Diff            @@
##            master        #6   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           51        65   +14     
=========================================
+ Hits            51        65   +14     

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

@robertrossmann robertrossmann merged commit a48eb15 into master Feb 29, 2024
2 checks passed
@robertrossmann robertrossmann deleted the feat/retries branch February 29, 2024 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants