Simple library for retry mechanism. Context allow to set context of retry default are Background context. Return the direct last error that came from the retried function default is false (return wrapped errors with everything) WithTimer provides a way to swap out timer module implementations. This primarily is useful for mocking/testing, where you may not want to explicitly wait for a set duration for retries. DelayTypeFunc is called to return the next delay to wait after the retriable function fails on err after n attempts. FixedDelay is a DelayType that keeps delay the same through all iterations. DelayTypeFunc accepts a new parameter err - this breaking change affects only your custom Delay Functions. RetryIf controls whether a retry should be attempted after an error (assuming there are any retry attempts remaining).

Features

  • Sightly complicated interface
  • Infinity retry is possible by set Attempts(0) by PR #49
  • BackOffDelay is a DelayType which increases delay between consecutive retries
  • FixedDelay is a DelayType which keeps delay the same through all iterations
  • WrappedErrors returns the list of errors that this Error is wrapping
  • Setting to 0 will retry until the retried function succeeds. default is 10

Project Samples

Project Activity

See All Activity >

Categories

Libraries

License

MIT License

Follow retry

retry Web Site

Other Useful Business Software
Full-stack observability with actually useful AI | Grafana Cloud Icon
Full-stack observability with actually useful AI | Grafana Cloud

Our generous forever free tier includes the full platform, including the AI Assistant, for 3 users with 10k metrics, 50GB logs, and 50GB traces.

Built on open standards like Prometheus and OpenTelemetry, Grafana Cloud includes Kubernetes Monitoring, Application Observability, Incident Response, plus the AI-powered Grafana Assistant. Get started with our generous free tier today.
Create free account
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of retry!

Additional Project Details

Operating Systems

Linux, Mac, Windows

Programming Language

Go

Related Categories

Go Libraries

Registered

2023-01-31