mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 02:05:30 +00:00
http_private: add config field db_connections_per_worker
This commit is contained in:
parent
b2a3c034b0
commit
26cd34f10a
2 changed files with 3 additions and 1 deletions
|
|
@ -18,6 +18,7 @@ pub struct Config {
|
||||||
/// generate responses and send them back to the socket workers.
|
/// generate responses and send them back to the socket workers.
|
||||||
pub request_workers: usize,
|
pub request_workers: usize,
|
||||||
pub worker_channel_size: usize,
|
pub worker_channel_size: usize,
|
||||||
|
pub db_connections_per_worker: u32,
|
||||||
pub log_level: LogLevel,
|
pub log_level: LogLevel,
|
||||||
pub network: NetworkConfig,
|
pub network: NetworkConfig,
|
||||||
pub protocol: ProtocolConfig,
|
pub protocol: ProtocolConfig,
|
||||||
|
|
@ -31,6 +32,7 @@ impl Default for Config {
|
||||||
socket_workers: 1,
|
socket_workers: 1,
|
||||||
request_workers: 1,
|
request_workers: 1,
|
||||||
worker_channel_size: 128,
|
worker_channel_size: 128,
|
||||||
|
db_connections_per_worker: 1,
|
||||||
log_level: LogLevel::default(),
|
log_level: LogLevel::default(),
|
||||||
network: NetworkConfig::default(),
|
network: NetworkConfig::default(),
|
||||||
protocol: ProtocolConfig::default(),
|
protocol: ProtocolConfig::default(),
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ async fn run_app(
|
||||||
);
|
);
|
||||||
|
|
||||||
let pool = MySqlPoolOptions::new()
|
let pool = MySqlPoolOptions::new()
|
||||||
.max_connections(5)
|
.max_connections(config.db_connections_per_worker)
|
||||||
.connect(&db_url)
|
.connect(&db_url)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue