File tree Expand file tree Collapse file tree 3 files changed +25
-8
lines changed
Expand file tree Collapse file tree 3 files changed +25
-8
lines changed Original file line number Diff line number Diff line change @@ -13,15 +13,15 @@ const connectionString = env.DATABASE_URL
1313const socketDb = drizzle (
1414 postgres ( connectionString , {
1515 prepare : false ,
16- idle_timeout : 20 ,
17- connect_timeout : 10 ,
18- max : 5 ,
16+ idle_timeout : 10 ,
17+ connect_timeout : 20 ,
18+ max : 15 ,
1919 onnotice : ( ) => { } ,
2020 } ) ,
2121 { schema }
2222)
2323
24- // Use dedicated connection for socket operations
24+ // Use dedicated connection for socket operations, fallback to shared db for compatibility
2525const db = socketDb
2626
2727// Constants
Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ const connectionString = env.DATABASE_URL
1111const db = drizzle (
1212 postgres ( connectionString , {
1313 prepare : false ,
14- idle_timeout : 20 ,
15- connect_timeout : 10 ,
14+ idle_timeout : 15 ,
15+ connect_timeout : 20 ,
1616 max : 3 ,
1717 onnotice : ( ) => { } ,
1818 } ) ,
Original file line number Diff line number Diff line change @@ -10,11 +10,28 @@ if (!connectionString) {
1010 throw new Error ( 'Missing DATABASE_URL environment variable' )
1111}
1212
13+ console . log (
14+ '[DB Pool Init]' ,
15+ JSON . stringify ( {
16+ timestamp : new Date ( ) . toISOString ( ) ,
17+ nodeEnv : process . env . NODE_ENV ,
18+ action : 'CREATING_CONNECTION_POOL' ,
19+ poolConfig : {
20+ max : 30 ,
21+ idle_timeout : 20 ,
22+ connect_timeout : 30 ,
23+ prepare : false ,
24+ } ,
25+ pid : process . pid ,
26+ isProduction : process . env . NODE_ENV === 'production' ,
27+ } )
28+ )
29+
1330const postgresClient = postgres ( connectionString , {
1431 prepare : false ,
1532 idle_timeout : 20 ,
16- connect_timeout : 10 ,
17- max : 20 ,
33+ connect_timeout : 30 ,
34+ max : 30 ,
1835 onnotice : ( ) => { } ,
1936} )
2037
You can’t perform that action at this time.
0 commit comments