p-retry retries a promise-returning or async function when it fails, using exponential backoff and configurable retry rules. It includes options and callbacks to control which errors should consume retry attempts and when to abort (for example with AbortError or AbortSignal). Useful for adding resilient retries around operations like network calls.
Project status
- Actively maintained: The repo shows recent progress, with the latest known update (v8.0.0) pushed on 2026-03-26 and a series of updates in 2025-10, 2025-12, and 2026-03, indicating ongoing maintenance rather than abandonment.
- Update cadence: Updates appear irregular but not stagnant, roughly every 1 to 4 months across the observed period (late 2025 into early 2026), with the latest update now about 4.5 months old as of 2026-08-12.
AI summary generated
Recent updates
v8.0.0
v8.0.0 raises the minimum supported Node.js version to 22 and changes the internal callback ordering for retries. It also extends the retry callback context with a computed `retryDelay`, and hardens retry timing and callback validation behavior.
BreakingFeaturesv7.1.1
v7.1.1 is a targeted fix for p-retry abort behavior, specifically when the AbortSignal is already aborted before the retry code enters the delay phase. The code adds an explicit abort check right before waiting on the delay, and includes a new test to verify it cancels immediately.
v7.1.0
v7.1.0 introduces a new `shouldConsumeRetry` option that lets callers decide whether a particular failure should decrement the retry budget. The implementation also expands the retry context to include retry consumption state (`retriesConsumed`) and changes internal timing behavior for `maxRetryTime` and `minTimeout`.
Featuresv7.0.0
v7.0.0 introduces Node.js 20 as a requirement, removes the legacy `forever` option, and changes `onFailedAttempt` and `shouldRetry` to receive a `context` object. The release also claims a full rewrite that removes the dependency on the `retry` package and adds a `makeRetriable` helper.
BreakingFeaturesv7.0.0-0
v7.0.0-0 is a major rewrite of p-retry that drops the `retry` package, requiring Node.js 20, and changes retry callback signatures to receive a context object. It also removes the `forever` option in favor of `retries: Infinity`.
BreakingFeaturesv6.2.1
v6.2.1 focuses on preventing `pRetry` from misbehaving when the `onFailedAttempt` and `shouldRetry` options are explicitly set to `undefined`. The implementation now uses nullish-coalescing defaulting so undefined values revert to the library defaults instead of remaining undefined.
v6.2.0
v6.2.0 adds a new retry control option, `shouldRetry`, allowing callers to decide whether a given thrown error should trigger another retry. The change is reflected in the TypeScript types, README, and a new test that validates the gating behavior.
Featuresv6.1.0
Release v6.1.0 updates p-retry's network error detection logic by moving it into the separate `is-network-error` package. The main functional change is in how `TypeError` instances are classified as network errors during retry handling.
v6.0.0
Release v6.0.0 primarily raises the supported Node.js baseline to Node 16 and includes a fix around abort listener cleanup. The code changes also refactor AbortController handling and adjust TypeScript declaration shapes, neither of which are fully described in the release notes.
Breakingv5.1.2
v5.1.2 adds Undici-specific network error handling so p-retry can recognize additional network failures and retry appropriately. The only code change is expanding the set of error message strings treated as network errors.