Registry / devops / promise-pool-ext

promise-pool-ext

JSON →
library4.0.1jsnpmunverified

Queue promises into a pool with configurable concurrency, timeout, and debounce. Latest v4.0.1 (2024) is ESM-only, requires Node >= 20. Provides Pool (limiting concurrency), PoolManager (ordered task execution with dependencies), and SeqWorker (sequential queue). Differentiators: sequential worker with debounce, dependency-aware PoolManager, and collective rejection behavior on first error.

npm install promise-pool-ext
INSTALL
IMPORT
SIG · PROMISE-POOL-EXT
P
promise-pool-ext
devopsjavascriptv4.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Pool
import { Pool } from 'promise-pool-ext'
const { Pool } = require('promise-pool-ext')
ESM-only since v4; CommonJS require will fail.
PoolManager
import { PoolManager } from 'promise-pool-ext'
import PoolManager from 'promise-pool-ext'
Named export, not default export.
SeqWorker
import { SeqWorker } from 'promise-pool-ext'
import { SequenceWorker } from 'promise-pool-ext'
Exact name is SeqWorker, not SequenceWorker.

Creates a Pool with concurrency 3, runs three async tasks, and logs the results in order.

import { Pool } from 'promise-pool-ext'; const pool = Pool({ concurrency: 3 }); const tasks = [ () => new Promise(resolve => setTimeout(() => resolve('A'), 100)), () => new Promise(resolve => setTimeout(() => resolve('B'), 50)), () => new Promise(resolve => setTimeout(() => resolve('C'), 150)), ]; async function main() { const results = await pool(tasks); console.log(results); // ['A', 'B', 'C'] } main().catch(console.error);
Debug
Known issues
breakingPackage is ESM-only as of v4. Use dynamic import() or switch to ESM in your project. const { Pool } = require('promise-pool-ext') will throw ERR_REQUIRE_ESM.
fix
Convert your project to ESM (set type: module in package.json) or use import() syntax.
affects: >=4.0.0
breakingNode.js version >= 20 is required starting from v4. Older versions are unsupported.
fix
Upgrade Node.js to v20 or later.
affects: >=4.0.0
deprecatedThe PoolManager 'requires' option set to '*' is deprecated and may be removed in a future version. Use an array of all previous task keys instead.
fix
Replace requires: '*' with requires: ['check1', 'check2', ...] listing all required tasks.
affects: >=4.0.0
gotchaPool and PoolManager reject once any promise fails, but only after all in-flight promises complete. This can cause long delays in error handling.
fix
Implement per-task error handling inside the task functions, or set a timeout to bound execution time.
affects: >=0.0.0
gotchaThe 'timeout' option applies to each individual task, not the entire batch. A single long task can hold up the pool but won't abort it.
fix
Use a separate timeout mechanism if you need to abort the whole batch on timeout.
affects: >=0.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/promise-pool-ext/dist/index.js from ... not supported.
Package is ESM-only, but you are using CommonJS require()
fix
Use import { Pool } from 'promise-pool-ext' or switch to ESM.
TypeError: Pool is not a constructor
Importing Pool as a default import instead of named import
fix
Use import { Pool } from 'promise-pool-ext' (curly braces).
TypeError: pool(...) is not a function
Calling Pool without the new keyword or calling an instance incorrectly. Pool() returns a function.
fix
Correct usage: const pool = Pool({ concurrency: 3 }); pool(tasks);
Upgrade
Version history
4.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
promise-pool-ext — npm install promise-pool-ext · libregistry