* Parse one file on the pool. Resolves with the extraction result, or REJECTS * if the parse times out or its worker crashes — the caller records the error * and (for worker-exit/OOM/timeout rejections) re-attempts in its retry pass.
(task: ParseTask)
| 240 | * and (for worker-exit/OOM/timeout rejections) re-attempts in its retry pass. |
| 241 | */ |
| 242 | requestParse(task: ParseTask): Promise<ExtractionResult> { |
| 243 | if (this.destroyed) return Promise.reject(new Error('Parse pool destroyed')); |
| 244 | return new Promise<ExtractionResult>((resolve, reject) => { |
| 245 | this.queue.push({ id: this.nextId++, task, resolve, reject, settled: false }); |
| 246 | this.drain(); |
| 247 | }); |
| 248 | } |
| 249 | |
| 250 | private spawnOne(): void { |
| 251 | if (this.destroyed || this.workers.size >= this.maxSize || !this.healthy) return; |
no test coverage detected