OnceMore - Simple retries with composable backoff strategies

Hi everyone! I’ve just released OnceMore, a new retry library for Elixir that focuses on simplicity and composability.

Features

  • Composable backoff strategies via delay streams
  • Precise control over retry conditions through predicates
  • Support for stateful retries with accumulators

Example

import OnceMore.DelayStreams

# Basic retry with exponential backoff
OnceMore.retry(
  fn -> make_network_call() end,
  &match?({:error, _}, &1),
  Stream.take(exponential_backoff(), 5)
)

# Retry with accumulator to track state
OnceMore.retry_with_acc(
  fn attempts -> {network_call(), attempts + 1} end,
  fn result, _attempts -> match?({:error, _}, result) end,
  0,
  Stream.take(constant_backoff(), 5)
)

Why another retry library?

I wanted to improve the current experience offered by Retry in several key areas:

  • Precise retry conditions: OnceMore lets you specify exactly which error conditions should trigger retries through predicate functions, rather than using predefined categories.
  • Functional design: Instead of using macros and DSL, OnceMore provides a straightforward functional API.

For a more detailed explanation, please refer to Problems with Retry — OnceMore v1.0.0

Let me know if you have any questions!

Repo: GitHub - vegris/once_more: Simple retries with composable backoff strategies
Hex: once_more | Hex
HexDocs: OnceMore v1.0.0 — Documentation

6 Likes