File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -118,8 +118,10 @@ export const init: (config: PoolConfig) => {
118118 attributes : { sql : trackQueryInSentry ? sql : 'custom' } ,
119119 } ,
120120 async ( ) => {
121+ // Use statement_timeout AND idle_session_timeout to ensure the connection will be killed even if idle after
122+ // timeout time.
121123 const statementTimeoutQueryPrefix = statementQueryTimeout
122- ? `SET statement_timeout='${ statementQueryTimeout } s';`
124+ ? `SET statement_timeout='${ statementQueryTimeout } s'; SET idle_session_timeout=' ${ statementQueryTimeout } s'; `
123125 : ''
124126 // node-postgres need a statement_timeout to kill the connection when timeout is reached
125127 // otherwise the query will keep running on the database even if query timeout was reached
You can’t perform that action at this time.
0 commit comments