PitchHut
Log in / Sign up
recur
5 views
Effortlessly retry commands with smart timing.
Pitch

Recur is a command-line tool designed for reliability. It automatically retries commands until they succeed, utilizing exponential backoff and configurable jitter to optimize timing. You can define custom success conditions using Starlark, making it versatile for various scenarios. Let recur handle the retries for you, ensuring that transient issues can be managed efficiently.

Description

recur is a powerful command-line utility designed to execute a command repeatedly until it achieves success or exhausts the maximum number of attempts. Built with flexibility in mind, it features customizable exponential backoff strategies along with configurable jitter to minimize simultaneous retry attempts, thus preventing network congestion (commonly known as the Thundering Herd Problem).

Key Features

  • Exponential Backoff & Jitter: Smartly handles retries, spacing them out based on previous failures, with added randomness to further reduce collisions.
  • Custom Conditions with Starlark: Define your success criteria using Starlark, a Python-derived scripting language, making it easy for Python developers to adapt.
  • Comprehensive Command Arguments: The utility offers various flags and arguments to customize behavior, ensuring it meets a wide array of use cases.

Usage Example

Here’s a quick look at how to use recur in your command line:

Usage: recur [-a <attempts>] [-b <backoff>] [-c <condition>] [-d <delay>] [-f]  
              [-j <jitter>] [-m <max-delay>] [-t <timeout>] [-v] <command> [<arg> ...]

Condition Scripting

The default success condition is based on the exit code of the command executed. For instance, if the command's exit code is 0, it indicates success. You can, however, tailor this logic extensively using Starlark expressions. Here’s an example of usage:

recur --condition 'code != 0 and exit(0)' sh -c 'exit 1'

Why Choose recur?

Unlike other retry utilities, recur is built using Go, eliminating the need for Node.js dependencies. It provides a simple yet robust way to manage command retries without the overhead of traditional scripting solutions. With an intuitive interface and powerful scripting capabilities, recur is an excellent choice for developers looking to automate command execution smoothly.

For detailed documentation on setting up and customizing your commands with recur, delve into the GitHub repository.