<commit_before>const Pool = require('pg-pool');
const NativeClient = require('pg').native.Client;

const logger = require("../util/logger");

const pool = new Pool({
    user: 'postgres',           // env var: PGUSER
    database: 'realtimebus',    // env var: PGDATABASE
    password: '<PASSWORD>',           // env var: PGPASSWORD
    host: 'localhost',          // Server hosting the postgres database
    port: 5432,                 // env var: PGPORT
    max: 10,                    // max number of clients in the pool
    idleTimeoutMillis: 30000,   // how long a client is allowed to remain idle before being closed
    Client: NativeClient
});

pool.on('error', function(error, client) {
    logger.error(`SQL error: ${error}`)
});

pool.on('connect', client => {
    logger.warn(`Connected client: ${client}`)
});

module.exports.connect = function(err, client, done) {
    return pool.connect(err, client, done)
};

// export the query method for passing queries to the pool
module.exports.query = function (text, values, callback) {<commit_msg>Tweaked pool size and timeout<commit_after>const Pool = require('pg-pool');
const NativeClient = require('pg').native.Client;

const logger = require("../util/logger");

const pool = new Pool({
    user: 'postgres',           // env var: PGUSER
    database: 'realtimebus',    // env var: PGDATABASE
    password: '<PASSWORD>',           // env var: PGPASSWORD
    host: 'localhost',          // Server hosting the postgres database
    port: 5432,                 // env var: PGPORT
    max: 32,                    // max number of clients in the pool
    idleTimeoutMillis: 10 * 60 * 1000,   // how long a client is allowed to remain idle before being closed
    Client: NativeClient
});

pool.on('error', function(error, client) {
    logger.error(`SQL error: ${error}`)
});

pool.on('connect', client => {
    logger.warn(`Connected client: ${client}`)
});

module.exports.connect = function(err, client, done) {
    return pool.connect(err, client, done)
};

// export the query method for passing queries to the pool
module.exports.query = function (text, values, callback) {
{'fraction_non_alphanumeric': 0.13476836686944316, 'fraction_numerical': 0.01169864295741694, 'mean_word_length': 2.8661844484629295, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2600428', 'n_tokens_mistral': 620, 'n_tokens_neox': 605, 'n_words': 204}