MCPcopy Index your code
hub / github.com/brianc/node-postgres / end

Method end

packages/pg/lib/client.js:734–762  ·  view source on GitHub ↗
(cb)

Source from the content-addressed store, hash-verified

732 }
733
734 end(cb) {
735 this._ending = true
736
737 // if we have never connected, then end is a noop, callback immediately
738 if (!this.connection._connecting || this._ended) {
739 if (cb) {
740 cb()
741 return
742 } else {
743 return this._Promise.resolve()
744 }
745 }
746
747 if (this._getActiveQuery() || !this._queryable) {
748 // if we have an active query we need to force a disconnect
749 // on the socket - otherwise a hung query could block end forever
750 this.connection.stream.destroy()
751 } else {
752 this.connection.end()
753 }
754
755 if (cb) {
756 this.connection.once('end', cb)
757 } else {
758 return new this._Promise((resolve) => {
759 this.connection.once('end', resolve)
760 })
761 }
762 }
763 get queryQueue() {
764 queryQueueDeprecationNotice()
765 return this._queryQueue

Callers 15

newClientMethod · 0.95
runFunction · 0.95
connectClientFunction · 0.95
throwErrorFunction · 0.95
notifyFunction · 0.95
executeFunction · 0.95
runFunction · 0.95
innerFunctionFunction · 0.95
getAppNameFunction · 0.95
getServerVersionNumFunction · 0.95
testClientVersionFunction · 0.95

Calls 3

_getActiveQueryMethod · 0.95
cbFunction · 0.85
destroyMethod · 0.80

Tested by

no test coverage detected