Format with prettier

This commit is contained in:
Brian Carlson 2022-02-04 10:27:51 -06:00
parent edf1a864d6
commit 9a61e9ac58
2 changed files with 9 additions and 3 deletions

View File

@ -255,9 +255,14 @@ class Pool extends EventEmitter {
setTimeout(() => {
this.log('ending client due to expired lifetime')
this._expired.add(client)
const idleIndex = this._idle.findIndex(idleItem => idleItem.client === client)
const idleIndex = this._idle.findIndex((idleItem) => idleItem.client === client)
if (idleIndex !== -1) {
this._acquireClient(client, new PendingItem((err, client, clientRelease) => clientRelease()), idleListener, false)
this._acquireClient(
client,
new PendingItem((err, client, clientRelease) => clientRelease()),
idleListener,
false
)
}
}, this.options.maxLifetimeSeconds * 1000)
}

View File

@ -29,7 +29,8 @@ describe('lifetime timeout', () => {
done()
})
})
it('can remove expired clients and recreate them',
it(
'can remove expired clients and recreate them',
co.wrap(function* () {
const pool = new Pool({ maxLifetimeSeconds: 1 })
let query = pool.query('SELECT pg_sleep(1)')