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
MongoDB Atlas runs apps anywhere Icon
MongoDB Atlas runs apps anywhere

Deploy in 115+ regions with the modern database for every enterprise.

MongoDB Atlas gives you the freedom to build and run modern applications anywhere—across AWS, Azure, and Google Cloud. With global availability in over 115 regions, Atlas lets you deploy close to your users, meet compliance needs, and scale with confidence across any geography.
Start Free
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