(envVal: string | undefined, cpuCount: number)
| 149 | * frees the transport and lets responses flush incrementally. |
| 150 | */ |
| 151 | export function resolvePoolSize(envVal: string | undefined, cpuCount: number): number { |
| 152 | if (envVal !== undefined && envVal !== '') { |
| 153 | const n = Number(envVal); |
| 154 | if (Number.isFinite(n) && n >= 0) return Math.min(Math.floor(n), MAX_POOL_SIZE); |
| 155 | // non-numeric / negative → fall through to the default |
| 156 | } |
| 157 | return Math.max(1, Math.min(cpuCount - 1, MAX_POOL_SIZE)); |
| 158 | } |
| 159 | |
| 160 | function resolveBusyTimeoutMs(): number { |
| 161 | const raw = process.env.CODEGRAPH_QUERY_BUSY_TIMEOUT_MS; |
no test coverage detected