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

Function closed

deno/src/connection.js:439–461  ·  view source on GitHub ↗
(hadError)

Source from the content-addressed store, hash-verified

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