| 1575 | // declined. |
| 1576 | let poolEngageTried = false; |
| 1577 | const createPool = (t0: number, why: string): ResolverPool | null => { |
| 1578 | poolEngageTried = true; |
| 1579 | if (!parallel) return null; |
| 1580 | const p = ResolverPool.tryCreate(parallel.dbPath, this.projectRoot); |
| 1581 | p?.ready().then( |
| 1582 | () => { |
| 1583 | poolReady = true; |
| 1584 | if (process.env.CODEGRAPH_SYNTH_TIMINGS) console.error(`[pool-timing] pool ready after ${Date.now() - t0}ms (${why})`); |
| 1585 | }, |
| 1586 | () => { |
| 1587 | void p.destroy().catch(() => undefined); |
| 1588 | if (pool === p) pool = null; |
| 1589 | } |
| 1590 | ); |
| 1591 | return p; |
| 1592 | }; |
| 1593 | if (parallel && total >= minRefsForPool()) { |
| 1594 | pool = createPool(Date.now(), 'ref-count'); |
| 1595 | } |