Skip to content

Commit 019b4d1

Browse files
committed
Add onError config for pool
To handle idle pool errors see brianc/node-postgres#1324
1 parent 15ac75c commit 019b4d1

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎src/client.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,11 @@ assign(Client.prototype, {
291291
return;
292292
}
293293

294-
this.pool = new Pool(this.getPoolSettings(config.pool));
294+
const { onError, ...poolConfig } = config.pool;
295+
this.pool = new Pool(this.getPoolSettings(poolConfig));
296+
if (onError) {
297+
this.pool.on('error', onError);
298+
}
295299
},
296300

297301
validateConnection(connection) {

0 commit comments

Comments
 (0)