MCPcopy
hub / github.com/webpack/webpack / processQueueWorker

Method processQueueWorker

lib/MultiCompiler.js:589–627  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

587 process.nextTick(processQueueWorker);
588 };
589 const processQueueWorker = () => {
590 // eslint-disable-next-line no-unmodified-loop-condition
591 while (running < parallelism && queue.length > 0 && !errored) {
592 const node = /** @type {Node} */ (queue.dequeue());
593 if (
594 node.state === "queued" ||
595 (node.state === "blocked" &&
596 node.parents.every((p) => p.state === "done"))
597 ) {
598 running++;
599 node.state = "starting";
600 run(
601 node.compiler,
602 /** @type {SetupResult} */ (node.setupResult),
603 nodeDone.bind(null, node)
604 );
605 node.state = "running";
606 }
607 }
608 processing = false;
609 if (
610 !errored &&
611 running === 0 &&
612 nodes.every((node) => node.state === "done")
613 ) {
614 /** @type {Stats[]} */
615 const stats = [];
616 for (const node of nodes) {
617 const result = node.result;
618 if (result) {
619 node.result = undefined;
620 stats.push(result);
621 }
622 }
623 if (stats.length > 0) {
624 callback(null, new MultiStats(stats));
625 }
626 }
627 };
628 processQueueWorker();
629 return setupResults;
630 }

Callers

nothing calls this directly

Calls 4

runFunction · 0.50
callbackFunction · 0.50
dequeueMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected