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

Function closed

cf/src/connection.js:438–460  ·  view source on GitHub ↗
(hadError)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected