diff --git a/src/client.ts b/src/client.ts index 71ec03d..36a7155 100644 --- a/src/client.ts +++ b/src/client.ts @@ -99,11 +99,17 @@ export class RDSClient extends Operator { } get stats() { + const acquiringConnections = this.#pool._acquiringConnections.length; + const allConnections = this.#pool._allConnections.length; + const freeConnections = this.#pool._freeConnections.length; + const connectionQueue = this.#pool._connectionQueue.length; + const busyConnections = allConnections - freeConnections - acquiringConnections; return { - acquiringConnections: this.#pool._acquiringConnections.length, - allConnections: this.#pool._allConnections.length, - freeConnections: this.#pool._freeConnections.length, - connectionQueue: this.#pool._connectionQueue.length, + acquiringConnections, + allConnections, + freeConnections, + connectionQueue, + busyConnections, }; } diff --git a/test/client.test.ts b/test/client.test.ts index accfe2a..e1160f1 100644 --- a/test/client.test.ts +++ b/test/client.test.ts @@ -1340,11 +1340,11 @@ describe('test/client.test.ts', () => { describe('get stats()', () => { it('should get client stats', async () => { const stats = db.stats; - console.log(stats); assert.equal(typeof stats.acquiringConnections, 'number'); assert.equal(typeof stats.allConnections, 'number'); assert.equal(typeof stats.freeConnections, 'number'); assert.equal(typeof stats.connectionQueue, 'number'); + assert.equal(typeof stats.busyConnections, 'number'); }); });