Skip to content

Commit e69c1f8

Browse files
committed
Do not use pool for clients with custom config nor for listeners
1 parent af8bc38 commit e69c1f8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

postgresql.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,13 @@ module.exports = function (RED) {
220220
downstreamReady = true;
221221

222222
try {
223-
if (msg.pgConfig) {
224-
client = new Client(msg.pgConfig);
223+
if (msg.pgConfig || node.listen) {
224+
// Do not use pool for clients with custom config nor for listeners
225+
const pgConfig = Object.assign({},
226+
node.config.pgPool.options, {
227+
password: node.config.password,
228+
}, msg.pgConfig);
229+
client = new Client(pgConfig);
225230
await client.connect();
226231
} else {
227232
client = await node.config.pgPool.connect();

0 commit comments

Comments
 (0)