(opts: QueryPoolOptions)
| 160 | private readonly createWorker: () => PoolWorker; |
| 161 | |
| 162 | constructor(opts: QueryPoolOptions) { |
| 163 | this.root = opts.root; |
| 164 | this.maxSize = Math.max(1, Math.min(opts.size ?? Math.max(1, os.cpus().length - 1), MAX_POOL_SIZE)); |
| 165 | this.softTimeoutMs = opts.softTimeoutMs ?? resolveBusyTimeoutMs(); |
| 166 | this.maxRetries = opts.maxRetries ?? 1; |
| 167 | this.createWorker = opts.createWorker ?? (() => new Worker(WORKER_FILE, { workerData: { root: this.root } })); |
| 168 | this.spawnOne(); // one eager warm worker, ready for the first call |
| 169 | } |
| 170 | |
| 171 | /** Pool size cap (for logging/status). */ |
| 172 | get size(): number { return this.maxSize; } |
nothing calls this directly
no test coverage detected