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

Function end

cjs/src/index.js:365–378  ·  view source on GitHub ↗
({ timeout = null } = {})

Source from the content-addressed store, hash-verified

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