(envVal: string | undefined, cpuCount: number)
| 109 | * frees the transport and lets responses flush incrementally. |
| 110 | */ |
| 111 | export function resolvePoolSize(envVal: string | undefined, cpuCount: number): number { |
| 112 | if (envVal !== undefined && envVal !== '') { |
| 113 | const n = Number(envVal); |
| 114 | if (Number.isFinite(n) && n >= 0) return Math.min(Math.floor(n), MAX_POOL_SIZE); |
| 115 | // non-numeric / negative → fall through to the default |
| 116 | } |
| 117 | return Math.max(1, Math.min(cpuCount - 1, MAX_POOL_SIZE)); |
| 118 | } |
| 119 | |
| 120 | function resolveBusyTimeoutMs(): number { |
| 121 | const raw = process.env.CODEGRAPH_QUERY_BUSY_TIMEOUT_MS; |
no outgoing calls
no test coverage detected