File tree Expand file tree Collapse file tree 3 files changed +5
-4
lines changed
frameworks/Rust/hyperlane/src Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -14,3 +14,4 @@ pub const RANDOM_MAX_ADD_ONE: u32 = 10_001;
1414pub const KEY_ID : & str = "id" ;
1515pub const KEY_RANDOM_NUMBER : & str = "randomnumber" ;
1616pub const KEY_MESSAGE : & str = "message" ;
17+ pub const DB_MAX_CONNECTIONS : u32 = 100 ;
Original file line number Diff line number Diff line change @@ -100,9 +100,9 @@ pub async fn connection_db() -> DbPoolConnection {
100100 DATABASE_NAME
101101 ) ,
102102 } ;
103- let pool_size: u32 = num_cpus :: get ( ) as u32 ;
103+ let pool_size: u32 = ( ( get_thread_count ( ) as u32 ) << 1 ) . min ( DB_MAX_CONNECTIONS ) ;
104104 let pool: DbPoolConnection = PgPoolOptions :: new ( )
105- . max_connections ( 100 )
105+ . max_connections ( DB_MAX_CONNECTIONS )
106106 . min_connections ( pool_size)
107107 . max_lifetime ( None )
108108 . test_before_acquire ( false )
Original file line number Diff line number Diff line change 1- pub ( crate ) mod constant ;
1+ pub ( crate ) mod r#const ;
22pub ( crate ) mod db;
33pub ( crate ) mod lazy;
44pub ( crate ) mod request_middleware;
@@ -7,7 +7,7 @@ pub(crate) mod server;
77pub ( crate ) mod r#type;
88pub ( crate ) mod utils;
99
10- pub ( crate ) use constant :: * ;
10+ pub ( crate ) use r#const :: * ;
1111pub ( crate ) use db:: * ;
1212pub ( crate ) use hyperlane:: {
1313 futures:: { executor:: block_on, future:: join_all} ,
You can’t perform that action at this time.
0 commit comments