MCPcopy Index your code
hub / github.com/nodejs/node / limit

Function limit

test/common/wpt.js:536–557  ·  view source on GitHub ↗
(concurrency)

Source from the content-addressed store, hash-verified

534const NODE_UNCAUGHT = 100;
535
536const limit = (concurrency) => {
537 let running = 0;
538 const queue = [];
539
540 const execute = async (fn) => {
541 if (running < concurrency) {
542 running++;
543 try {
544 await fn();
545 } finally {
546 running--;
547 if (queue.length > 0) {
548 execute(queue.shift());
549 }
550 }
551 } else {
552 queue.push(fn);
553 }
554 };
555
556 return execute;
557};
558
559class WPTRunner {
560 constructor(path, { concurrency = os.availableParallelism() - 1 || 1 } = {}) {

Callers 1

runJsTestsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…