(opts: QueryPoolOptions)
| 218 | private lastServer?: PoolWorker; |
| 219 | |
| 220 | constructor(opts: QueryPoolOptions) { |
| 221 | this.root = opts.root; |
| 222 | this.maxSize = Math.max(1, Math.min(opts.size ?? Math.max(1, os.cpus().length - 1), MAX_POOL_SIZE)); |
| 223 | this.softTimeoutMs = opts.softTimeoutMs ?? resolveBusyTimeoutMs(); |
| 224 | this.maxRetries = opts.maxRetries ?? 1; |
| 225 | this.idleShrinkMs = Math.max(0, opts.idleShrinkMs ?? DEFAULT_IDLE_SHRINK_MS); |
| 226 | this.idleKeepBytes = opts.idleKeepBytes ?? DEFAULT_IDLE_KEEP_BYTES; |
| 227 | this.retireTimeoutMs = opts.retireTimeoutMs ?? RETIRE_TIMEOUT_MS; |
| 228 | this.createWorker = opts.createWorker ?? (() => new Worker(WORKER_FILE, { workerData: { root: this.root } })); |
| 229 | this.startSettleMs = opts.startSettleMs ?? WORKER_START_SETTLE_MS; |
| 230 | this.spawnOne(); // one eager warm worker, ready for the first call |
| 231 | } |
| 232 | |
| 233 | /** Pool size cap (for logging/status). */ |
| 234 | get size(): number { return this.maxSize; } |
nothing calls this directly
no test coverage detected