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

You Might Also Like
Gen AI apps are built with MongoDB Atlas Icon
Gen AI apps are built with MongoDB Atlas

The database for AI-powered applications.

MongoDB Atlas is the developer-friendly database used to build, scale, and run gen AI and LLM-powered apps—without needing a separate vector database. Atlas offers built-in vector search, global availability across 115+ regions, and flexible document modeling. Start building AI apps faster, all in one place.
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