Back to Explore

sindresorhus/p-limit

GitHub
2 watchersOpen source

Last release:

p-limit runs multiple promise-returning or async functions with a configurable concurrency limit, so only a set number run at once. It is useful when you need to control parallel work in Node.js and browsers, and includes options like `clearQueue()` (optionally rejecting pending work) plus helpers like `limit.map()` and counters for active and pending promises.

Project status

  • Actively maintained: Recent updates span 2025-2026, with a latest tagged update (v7.3.0 on 2026-02-03) and a further upstream push on 2026-05-20, suggesting ongoing development rather than dormancy.
  • Update cadence: Updates appear to arrive on the order of a few months (for example, v7.2.0 in 2025-10, v7.3.0 in 2026-02). There may be in-between commits (latest push in May) but no tagged update is shown after v7.3.0 in the provided history.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v7.3.0

    v7.3.0 adds support for calling `pLimit()` with an options object (instead of only a concurrency number) and introduces a `rejectOnClear` option that affects what happens to pending tasks when `clearQueue()` is called. The implementation also refactors the queue items so pending promises can be rejected instead of being silently left unresolved.

    Features
  • v7.2.0

    v7.2.0 extends p-limit's `LimitFunction.map` to accept any iterable, not only arrays. The implementation converts the provided iterable into an array before applying the concurrency-limited mapping, and the TypeScript types, README, and tests were updated accordingly.

    Features
  • v7.1.1

    v7.1.1 is a small change release focused on TypeScript typings for `limitFunction`. The release notes only mention a type fix, but the diff shows the typing has been tightened in a way that can break existing TypeScript code.

  • v7.1.0

    Release v7.1.0 documents an enhancement to p-limit's batch mapping helper. The `limit.map()` mapper callback now receives the input value along with the corresponding element index.

    Features
  • v7.0.0

    v7.0.0 adds a new `limit.map(array, fn)` convenience method and updates the runtime behavior so `activeCount` increments when tasks actually start running (not when they are queued). The release also requires Node.js 20+ and includes an internal performance improvement aimed at reducing scheduling overhead.

    BreakingFeatures
  • v6.2.0

    This release adds a new named export, `limitFunction`, which wraps a promise-returning function so its invocations are throttled by a concurrency limit. It also updates the TypeScript declarations and README to document the new API, and adds a corresponding test.

    Features
  • v6.1.0

    v6.1.0 introduces support for changing the concurrency limit after creating a limiter instance. The code adds a new public `concurrency` property (getter and setter) on the limiter, and updates scheduling logic so the queue respects the (possibly updated) concurrency value.

    Features
  • v6.0.0

    Release v6.0.0 focuses on an internal performance improvement (#83). It also changes the update timing of p-limit’s internal counters (activeCount and pendingCount), which the release notes call out as the reason for a major version.

    Breaking
  • v5.0.0

    Release v5.0.0 updates p-limit to require Node.js 18 and includes a fix for AsyncResource propagation so async execution context is preserved across limited concurrency runs. The code changes also add infrastructure to support non-Node environments (via a stubbed async hooks implementation) and adjust TypeScript declaration structure.

    Breaking
  • v4.0.0

    p-limit v4.0.0 switches the package to ESM (including TypeScript typings) and updates the supported Node.js versions. The code diff also includes a major dependency upgrade (yocto-queue) and changes to the published type API surface.

    Breaking