Skip to content

Commit 94fea8f

Browse files
committed
Add close method to close but not end connections forever
1 parent 56873c2 commit 94fea8f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ function Postgres(a, b) {
7171
listen,
7272
notify,
7373
begin,
74+
close,
7475
end
7576
})
7677

@@ -325,6 +326,10 @@ function Postgres(a, b) {
325326
]).then(() => clearTimeout(timer))
326327
}
327328

329+
async function close() {
330+
await Promise.all(connections.map(c => c.end()))
331+
}
332+
328333
async function destroy(resolve) {
329334
await Promise.all(connections.map(c => c.terminate()))
330335
while (queries.length)

0 commit comments

Comments
 (0)