MCPcopy
hub / github.com/promptfoo/promptfoo / processQueue

Method processQueue

src/python/workerPool.ts:95–117  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93 }
94
95 private processQueue(): void {
96 // Drain the entire queue - process all waiting requests with available workers
97 while (this.queue.length > 0) {
98 const worker = this.getAvailableWorker();
99 if (!worker) {
100 return; // No workers available right now
101 }
102
103 const request = this.queue.shift();
104 if (!request) {
105 return;
106 }
107
108 logger.debug(`Processing queued request (${this.queue.length} remaining)`);
109
110 // Execute and attach queue processing to continue draining when done
111 worker
112 .call(request.functionName, request.args)
113 .then(request.resolve)
114 .catch(request.reject)
115 .finally(() => this.processQueue());
116 }
117 }
118
119 getWorkerCount(): number {
120 return this.workers.length;

Callers 2

initializeMethod · 0.95
executeMethod · 0.95

Calls 2

getAvailableWorkerMethod · 0.95
callMethod · 0.80

Tested by

no test coverage detected