Skip to content

Commit 199fa55

Browse files
committed
chore: reduce logging
Signed-off-by: Ricardo Arturo Cabral Mejía <[email protected]>
1 parent ad7ab69 commit 199fa55

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/database/client.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ import knex, { Knex } from 'knex'
44
import { createLogger } from '../factories/logger-factory'
55

66
((knex) => {
7+
const counters = {}
78
knex.Client.prototype.releaseConnection = function (connection) {
89
const released = this.pool.release(connection)
910

1011
if (released) {
11-
console.log(`${this.config.tag} conneciton pool: ${this.pool.numUsed()} used / ${this.pool.numFree()} free / ${this.pool.numPendingAcquires()} pending`)
12+
counters[this.config.tag] = (counters[this.config.tag] ?? 0) + 1
13+
if (counters[this.config.tag] % 10 === 0) {
14+
console.log(`${this.config.tag} connection pool: ${this.pool.numUsed()} used / ${this.pool.numFree()} free / ${this.pool.numPendingAcquires()} pending`)
15+
}
1216
}
1317

1418
return Promise.resolve()

0 commit comments

Comments
 (0)