Skip to content

Commit

Permalink
fix: from now _acquire return always a promise to avoid uncatchable e…
Browse files Browse the repository at this point in the history
…xception
bombjackit committed Jan 4, 2024

Verified

This commit was signed with the committer’s verified signature.
blink1073 Steven Silvester
1 parent 48c9c1f commit 55f5a9f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/base/connection-pool.js
Original file line number Diff line number Diff line change
@@ -363,7 +363,7 @@ class ConnectionPool extends EventEmitter {
*/

acquire (requester, callback) {
const acquirePromise = shared.Promise.resolve(this._acquire().promise).catch(err => {
const acquirePromise = shared.Promise.resolve(this._acquire()).catch(err => {
this.emit('error', err)
throw err
})
@@ -382,7 +382,7 @@ class ConnectionPool extends EventEmitter {
return shared.Promise.reject(new ConnectionError('Connection is closing', 'ENOTOPEN'))
}

return this.pool.acquire()
return this.pool.acquire().promise
}

/**

0 comments on commit 55f5a9f

Please sign in to comment.