()
| 93 | // health endpoint. connectionTimeoutMillis covers connect stalls; the race timer |
| 94 | // covers a hung query on an already-open connection. |
| 95 | async function probePostgres() { |
| 96 | const pool = getHealthPool(); |
| 97 | let timer; |
| 98 | const timeout = new Promise((_, reject) => { |
| 99 | timer = setTimeout(() => reject(new Error('postgres probe timeout')), 500); |
| 100 | timer.unref(); |
| 101 | }); |
| 102 | try { |
| 103 | await Promise.race([pool.query('SELECT 1'), timeout]); |
| 104 | } finally { |
| 105 | clearTimeout(timer); |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | // getEmbeddingDimensions() throws until initEmbeddings() has completed — a clean |
| 110 | // "is the provider up?" flag without adding an export to the embedder interface. |
no test coverage detected