Content
@
0 reply
0 recast
2 reactions
welter
@fun
⚠️ FarcasterUserStats.com is down i really need help, this is frustrating ‼️ postgres db connection limit maxed, i have a pool in place, not sure if that actually works or not sql queries to the db should be less than 1-2s max, but now they're going over 15s timing out
18 replies
12 recasts
28 reactions
TobyJaguar
@tobyjaguar
so the issue is the connections, not the query timeouts? As already stated, how are connections being released? Does each query open a new connection, and does that connection get released after the query? Kind of need to know the setup
1 reply
0 recast
0 reaction
welter
@fun
simplified version of what im doing, feel free to correct me if i'm wrong import { pool } from '../db' const client = await pool.connect(); const response = await pool.query(`query here`); client.release()
1 reply
0 recast
0 reaction
Ben
@data-nerd
Are you wrapping this logic in a try - catch - finally block? I wonder if maybe an error is occurring pool.query(`query here`) but because of the error the connection never gets released. const client = await pool.connect(); try { const response = await pool.query(`query here`); } ... finally { client.release(); }
1 reply
0 recast
1 reaction
TobyJaguar
@tobyjaguar
the errors should be caught though as well, so you could use the finally block or move the release to the catch block. Of course all async/await calls should be wrapped in a try/catch ;)
1 reply
0 recast
1 reaction