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

Method end

pool.ts:169–182  ·  view source on GitHub ↗

* This will close all open connections and set a terminated status in the pool * * ```ts * import { Pool } from "jsr:@db/postgres"; * const pool = new Pool({}, 10); * * await pool.end(); * console.assert(pool.available === 0, "There are connections available after ending the poo

()

Source from the content-addressed store, hash-verified

167 * ```
168 */
169 async end(): Promise<void> {
170 if (this.#ended) {
171 throw new Error("Pool connections have already been terminated");
172 }
173
174 await this.#ready;
175 while (this.available > 0) {
176 const client = await this.#available_connections!.pop();
177 await client.end();
178 }
179
180 this.#available_connections = undefined;
181 this.#ended = true;
182 }
183
184 /**
185 * Initialization will create all pool clients instances by default

Callers 9

generatePoolClientTestFunction · 0.95
poolWrapperFunction · 0.95
closeConnectionFunction · 0.45
generateSimpleClientTestFunction · 0.45
connection_test.tsFile · 0.45
mockReconnectionFunction · 0.45
pool_test.tsFile · 0.45
clientWrapperFunction · 0.45

Calls 1

popMethod · 0.45

Tested by

no test coverage detected