Modules@robinpath/retry

@robinpath/retry

0.1.0Public

Retry with exponential backoff and circuit breaker for RobinPath

@robinpath/retry

Retry with exponential backoff and circuit breaker patterns for resilient automation workflows

Category Functions Auth License

Why use this module?

The retry module lets you:

  • Execute a function with automatic retry and exponential backoff
  • Calculate the delay for a given retry attempt using exponential backoff
  • Check if an HTTP status code is retryable (408, 429, 500, 502, 503, 504)
  • Wait for a specified number of milliseconds
  • Preview the delay schedule for a series of retry attempts

All functions are callable directly from RobinPath scripts with a simple, consistent API.

Installation

npm install @robinpath/retry

Quick Start

No credentials needed — start using it right away:

retry.withBackoff 3 1000 2 30000

Available Functions

FunctionDescription
retry.executeExecute a function with automatic retry and exponential backoff
retry.withBackoffCalculate the delay for a given retry attempt using exponential backoff
retry.isRetryableCheck if an HTTP status code is retryable (408, 429, 500, 502, 503, 504)
retry.delayWait for a specified number of milliseconds
retry.attemptsPreview the delay schedule for a series of retry attempts
retry.createBreakerCreate a named circuit breaker with a failure threshold and reset timeout
retry.breakerStateGet the current state of a named circuit breaker
retry.breakerRecordRecord a success or failure in a circuit breaker
retry.breakerAllowCheck if a circuit breaker allows requests through
retry.breakerResetReset a circuit breaker to closed state

Examples

Calculate the delay for a given retry attempt using exponential backoff

retry.withBackoff 3 1000 2 30000

Check if an HTTP status code is retryable (408, 429, 500, 502, 503, 504)

retry.isRetryable 503

Wait for a specified number of milliseconds

retry.delay 2000

Integration with RobinPath

import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/retry";

const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);

const result = await rp.executeScript(`
  retry.withBackoff 3 1000 2 30000
`);

Full API Reference

See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.

Related Modules

License

MIT

Versions (1)

VersionTagPublished
0.1.0latestyesterday
Install
$ robinpath install @robinpath/retry
Version0.1.0
LicenseMIT
Unpacked Size5.7 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

Category

devops