File tree Expand file tree Collapse file tree 2 files changed +4
-11
lines changed
frameworks/Rust/hyperlane Expand file tree Collapse file tree 2 files changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ exclude = [
1919
2020[dependencies ]
2121hyperlane = " =4.59.1"
22+ num_cpus = " =1.16.0"
2223rand = " =0.9.0"
2324serde = " =1.0.219"
2425sqlx = { version = " =0.8.3" , features = [" runtime-tokio" , " postgres" ] }
Original file line number Diff line number Diff line change @@ -100,18 +100,10 @@ pub async fn connection_db() -> DbPoolConnection {
100100 DATABASE_NAME
101101 ) ,
102102 } ;
103- let pool_size: u32 = ( get_thread_count ( ) << 2 ) . max ( 10 ) . min ( 100 ) as u32 ;
104- let max_pool_size: u32 = option_env ! ( "POSTGRES_MAX_POOL_SIZE" )
105- . unwrap_or ( & pool_size. to_string ( ) )
106- . parse :: < u32 > ( )
107- . unwrap_or ( pool_size) ;
108- let min_pool_size: u32 = option_env ! ( "POSTGRES_MIN_POOL_SIZE" )
109- . unwrap_or ( & pool_size. to_string ( ) )
110- . parse :: < u32 > ( )
111- . unwrap_or ( pool_size) ;
103+ let pool_size: u32 = num_cpus:: get ( ) as u32 ;
112104 let pool: DbPoolConnection = PgPoolOptions :: new ( )
113- . max_connections ( max_pool_size )
114- . min_connections ( min_pool_size )
105+ . max_connections ( 100 )
106+ . min_connections ( pool_size )
115107 . max_lifetime ( None )
116108 . test_before_acquire ( false )
117109 . idle_timeout ( None )
You can’t perform that action at this time.
0 commit comments