New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

reretry

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reretry

Retry failed operations

latest
Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
332
6.07%
Maintainers
1
Weekly downloads
 
Created
Source

Retry

Retry failed operations using exponential backoff.

Example

import { retry } from 'reretry';

const result = await retry(async (again) => {
  const response = await fetch('https://example.com')

  if (!response.ok)
    return again // retry
  else
    return response.json()
}, {
  attempts: Infinity,
  base: 1000,
  max: 30000,
  factor: 1.5,
  dispersion: 0.1
})

Options

  • attempts - maximum number of attempts to retry, throws an error if exceeded. Default: Infinity.
  • base - base delay in milliseconds. Default: 1000.
  • max - maximum delay in milliseconds. Default: 30000.
  • factor - exponential factor. Default: 1.5.
  • dispersion - randomization factor. Default: 0.1.

Keywords

javascript

FAQs

Package last updated on 08 Sep 2026

Related posts