mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-13 18:32:12 +03:00
`solveInWorker` increments `activeWorkerCount` before constructing the Worker, but the `cleanup()` that decrements it lives inside the promise executor and only runs once the worker exists. Anything that throws first -- most obviously `resolveWorkerPath()` when the worker script is missing, since it resolves against `process.cwd()` -- leaves the counter permanently incremented. With `MAX_CONCURRENT_WORKERS = 2`, two such failures wedge the solver for the lifetime of the process: every later call rejects with "capacity reached (2)" while no worker is actually running, and the real cause is hidden. Construct the Worker inside a try/catch and release the slot before rejecting. Fixes #13094