MCPcopy Create free account
hub / github.com/ZenSystemAI/Zengram / probePostgres

Function probePostgres

api/src/index.js:95–107  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93// health endpoint. connectionTimeoutMillis covers connect stalls; the race timer
94// covers a hung query on an already-open connection.
95async 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.

Callers 1

index.jsFile · 0.85

Calls 2

getHealthPoolFunction · 0.85
queryMethod · 0.80

Tested by

no test coverage detected