Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5e91617

Browse files
fix: wait for pool.end()
Because when you don't pass a callback to .end() it always returns a promise
1 parent e81fc3d commit 5e91617

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

‎packages/pg-pool/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,16 +356,15 @@ class Pool extends EventEmitter {
356356
if (isExpired) {
357357
this.log('remove expired client')
358358
this._expired.delete(client)
359-
this._remove(client, this._pulseQueue.bind(this))
360-
return
359+
return this._remove(client, this._pulseQueue.bind(this))
361360
}
362361

363362
// idle timeout
364363
let tid
365364
if (this.options.idleTimeoutMillis) {
366365
tid = setTimeout(() => {
367366
this.log('remove idle client')
368-
this._remove(client)
367+
this._remove(client,this._pulseQueue.bind(this))
369368
}, this.options.idleTimeoutMillis)
370369

371370
if (this.options.allowExitOnIdle) {

‎packages/pg-pool/test/idle-timeout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe('idle timeout', () => {
5050
try {
5151
yield Promise.race([removal, timeout])
5252
} finally {
53-
pool.end()
53+
yieldpool.end()
5454
}
5555
})
5656
)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /