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