1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/lib/db/db-pool.js
Christopher Kolstad e952ae20a8
Added explicit pool settings in options.db object
- Also adds metrics for min and max pool size
- Metrics for free/used connections.
- Metrics for pending and current acquires

fixes: #705
2021-02-08 10:54:20 +01:00

21 lines
527 B
JavaScript

'use strict';
const knex = require('knex');
module.exports.createDb = function({ db, databaseSchema, getLogger }) {
const logger = getLogger('db-pool.js');
return knex({
client: 'pg',
version: db.version,
connection: db,
pool: db.pool,
searchPath: databaseSchema,
log: {
debug: msg => logger.debug(msg),
info: msg => logger.info(msg),
warn: msg => logger.warn(msg),
error: msg => logger.error(msg),
},
});
};