MCPcopy Index your code
hub / github.com/promptfoo/promptfoo / handleCrash

Method handleCrash

src/python/worker.ts:247–264  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

245 }
246
247 private handleCrash(): void {
248 this.ready = false;
249 this.crashCount++;
250
251 if (this.pendingRequest) {
252 this.pendingRequest.reject(new Error('Worker crashed'));
253 this.pendingRequest = null;
254 }
255
256 if (this.crashCount < this.maxCrashes) {
257 logger.warn(`Python worker crashed (${this.crashCount}/${this.maxCrashes}), restarting...`);
258 this.startWorker().catch((err) => {
259 logger.error(`Failed to restart worker: ${err}`);
260 });
261 } else {
262 logger.error(`Python worker crashed ${this.maxCrashes} times, marking as dead`);
263 }
264 }
265
266 isReady(): boolean {
267 return this.ready;

Callers 1

startWorkerMethod · 0.95

Calls 3

startWorkerMethod · 0.95
rejectMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected