You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 30, 2019. It is now read-only.
It seems that only pool-max-size errors can be caught when using pool.connect() function . following is a test case:
pg host is fake data and can not connect to . I thought output should catch 10 ETIMEDOUT errors, but actually it turns out catch only 3 which is pool-max-size, after changing max to 10 all errors can be caught. Is that means pool.connect() can only catch pool-max-size errors ? if so, how to make sure pool.connect() get client successfully or just pending because connections are larger than pool-max-size?
Thanks a lot !
const Pool = require('pg-pool')
// fake host
let config = {
host: '172.18.0.15',
port: 5432,
user: 'postgres',
password: 'postgres',
database: 'postgres',
max: 3,
min: 1,
schema: 'public'
};
const pool = new Pool(config)
pool.on('error', (err) => {
console.error('An idle client has experienced an error', err.stack);
});
const query = () => {
return pool.connect().then((client) => {
console.log('get client, then do nothing');
return 'OK';
}).catch((err) => {
console.error('catch an error! ');
// console.log(err);
});
};
for(let i = 0; i < 10; i++) {
query();
}
result:
catch an error!
catch an error!
catch an error!
The text was updated successfully, but these errors were encountered:
Hi,
It seems that only pool-max-size errors can be caught when using pool.connect() function . following is a test case:
pg host is fake data and can not connect to . I thought output should catch 10 ETIMEDOUT errors, but actually it turns out catch only 3 which is pool-max-size, after changing max to 10 all errors can be caught. Is that means pool.connect() can only catch pool-max-size errors ? if so, how to make sure pool.connect() get client successfully or just pending because connections are larger than pool-max-size?
Thanks a lot !
result:
The text was updated successfully, but these errors were encountered: