Skip to content

Commit 5065334

Browse files
committed
feat: update
1 parent 22dc806 commit 5065334

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

frameworks/Rust/hyperlane/src/constant.rs renamed to frameworks/Rust/hyperlane/src/const.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ pub const RANDOM_MAX_ADD_ONE: u32 = 10_001;
1414
pub const KEY_ID: &str = "id";
1515
pub const KEY_RANDOM_NUMBER: &str = "randomnumber";
1616
pub const KEY_MESSAGE: &str = "message";
17+
pub const DB_MAX_CONNECTIONS: u32 = 100;

frameworks/Rust/hyperlane/src/db.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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)

frameworks/Rust/hyperlane/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pub(crate) mod constant;
1+
pub(crate) mod r#const;
22
pub(crate) mod db;
33
pub(crate) mod lazy;
44
pub(crate) mod request_middleware;
@@ -7,7 +7,7 @@ pub(crate) mod server;
77
pub(crate) mod r#type;
88
pub(crate) mod utils;
99

10-
pub(crate) use constant::*;
10+
pub(crate) use r#const::*;
1111
pub(crate) use db::*;
1212
pub(crate) use hyperlane::{
1313
futures::{executor::block_on, future::join_all},

0 commit comments

Comments
 (0)