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

Function closed

cjs/src/connection.js:436–458  ·  view source on GitHub ↗
(hadError)

Source from the content-addressed store, hash-verified

434 }
435
436 async function closed(hadError) {
437 incoming = Buffer.alloc(0)
438 remaining = 0
439 incomings = null
440 clearImmediate(nextWriteTimer)
441 socket.removeListener('data', data)
442 socket.removeListener('connect', connected)
443 idleTimer.cancel()
444 lifeTimer.cancel()
445 connectTimer.cancel()
446
447 socket.removeAllListeners()
448 socket = null
449
450 if (initial)
451 return reconnect()
452
453 !hadError && (query || sent.length) && error(Errors.connection('CONNECTION_CLOSED', options, socket))
454 closedTime = performance.now()
455 hadError && options.shared.retries++
456 delay = (typeof backoff === 'function' ? backoff(options.shared.retries) : backoff) * 1000
457 onclose(connection, Errors.connection('CONNECTION_CLOSED', options, socket))
458 }
459
460 /* Handlers */
461 function handle(xs, x = xs[0]) {

Callers

nothing calls this directly

Calls 6

reconnectFunction · 0.70
errorFunction · 0.70
backoffFunction · 0.70
oncloseFunction · 0.70
cancelMethod · 0.65
clearImmediateFunction · 0.50

Tested by

no test coverage detected