Run multiple promise-returning & async functions with limited concurrency
by sindresorhusJavaScript
Last 12 weeks · 2 commits
4 of 6 standards met
Summary make use the limiter it belongs to instead of its call-time receiver cover detached calls sharing the limiter's configured concurrency with direct tasks Problem is exposed as a callable function property, but its implementation invokes the limiter through dynamic . A valid detached call such as therefore rejects with . Fix Use the closed-over function when scheduling mapped items. This preserves the existing concurrency, ordering, iterable, and index behavior without requiring a bound receiver. The regression test combines a direct limiter call with a detached call and verifies their shared maximum concurrency remains at the configured limit. Testing AVA suite on Node.js 20, 22, and 24 The aggregate command was also attempted. On this Windows checkout, XO reports its existing TypeScript project-service lookup error for and ; the same error occurs on the untouched base. The changed JavaScript files pass XO.
Repository: sindresorhus/p-limit. Description: Run multiple promise-returning & async functions with limited concurrency Stars: 2919, Forks: 141. Primary language: JavaScript. Languages: JavaScript (95.6%), TypeScript (4.4%). License: MIT. Latest release: v7.3.1 (1mo ago). Open PRs: 0, open issues: 0. Last activity: 1mo ago. Community health: 85%. Top contributors: sindresorhus, LinusU, jdmarshall, sugoroku-y, tuhm1, sethp, liuhanqu, zkochan, rajanpanth, schnittstabil and others.