File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,9 +58,9 @@ async function configureSessionTimeouts(pool: Pool): Promise<void> {
5858 const client = await pool . connect ( )
5959 try {
6060 const dbName = process . env . DB_NAME || 'squid'
61- await client . query ( `ALTER DATABASE "${ dbName } " SET idle_in_transaction_session_timeout = '2min '` )
62- await client . query ( `ALTER DATABASE "${ dbName } " SET idle_session_timeout = '5min '` )
63- console . log ( '[toast-vacuum] Configured database session timeouts (idle_in_transaction=2min , idle_session=5min )' )
61+ await client . query ( `ALTER DATABASE "${ dbName } " SET idle_in_transaction_session_timeout = '10min '` )
62+ await client . query ( `ALTER DATABASE "${ dbName } " SET idle_session_timeout = '20min '` )
63+ console . log ( '[toast-vacuum] Configured database session timeouts (idle_in_transaction=10min , idle_session=20min )' )
6464 } catch ( err ) {
6565 console . error ( '[toast-vacuum] Error configuring session timeouts:' , err )
6666 } finally {
@@ -82,10 +82,12 @@ export function startToastVacuumMonitor(): void {
8282 } )
8383
8484 // Configure database-level session timeouts to prevent idle transactions from blocking VACUUM
85- configureSessionTimeouts ( pool ) . then ( ( ) => checkAndVacuumToast ( pool ) ) . then ( ( ) => {
86- // Then repeat every 30 minutes
87- setInterval ( ( ) => {
88- checkAndVacuumToast ( pool )
89- } , CHECK_INTERVAL_MS )
90- } )
85+ configureSessionTimeouts ( pool )
86+ . then ( ( ) => checkAndVacuumToast ( pool ) )
87+ . then ( ( ) => {
88+ // Then repeat every 30 minutes
89+ setInterval ( ( ) => {
90+ checkAndVacuumToast ( pool )
91+ } , CHECK_INTERVAL_MS )
92+ } )
9193}
You can’t perform that action at this time.
0 commit comments