MCPcopy Create free account
hub / github.com/porsager/postgres / end

Function end

cf/src/index.js:366–379  ·  view source on GitHub ↗
({ timeout = null } = {})

Source from the content-addressed store, hash-verified

364 }
365
366 async function end({ timeout = null } = {}) {
367 if (ending)
368 return ending
369
370 await 1
371 let timer
372 return ending = Promise.race([
373 new Promise(r => timeout !== null && (timer = setTimeout(destroy, timeout * 1000, r))),
374 Promise.all(connections.map(c => c.end()).concat(
375 listen.sql ? listen.sql.end({ timeout: 0 }) : [],
376 subscribe.sql ? subscribe.sql.end({ timeout: 0 }) : []
377 ))
378 ]).then(() => clearTimeout(timer))
379 }
380
381 async function close() {
382 await Promise.all(connections.map(c => c.end()))

Callers

nothing calls this directly

Calls 2

endMethod · 0.65
thenMethod · 0.45

Tested by

no test coverage detected