node-postgres
node-postgres copied to clipboard
[Question]. Pass client config when using pool
Hey there and thank you for you time!
I have a question about using connection pool. The idea is to pass some configuration to all clients inside that pool, specifically idle_in_transaction_session_timeout. But because I'm using Pool, I configure the pool with corresponding settings and not the clients inside the pool.
As a workaround I use a connect event, but is there a better way to achieve this?
pool.on('connect', async (client) => {
await client
.query(`SET idle_in_transaction_session_timeout=30000`)