Skip to content

Commit

Permalink
Set default values
Browse files Browse the repository at this point in the history
  • Loading branch information
rmqtt committed Sep 25, 2023
1 parent e4cbea3 commit 61f6ac1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion rmqtt/src/settings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ impl Settings {
let cfg = Self::instance();
crate::log::debug!("Config info is {:?}", cfg.0);
crate::log::info!("node_id is {}", cfg.node.id);
crate::log::info!("exec_workers is {}", cfg.task.exec_workers);
crate::log::info!("exec_queue_max is {}", cfg.task.exec_queue_max);

if cfg.opts.node_grpc_addrs.is_some() {
crate::log::info!("node_grpc_addrs is {:?}", cfg.opts.node_grpc_addrs);
}
Expand All @@ -130,14 +133,21 @@ impl fmt::Debug for Settings {
}
}

#[derive(Default, Debug, Clone, Deserialize)]
#[derive(Debug, Clone, Deserialize)]
pub struct Task {
#[serde(default = "Task::exec_workers_default")]
pub exec_workers: usize,
#[serde(default = "Task::exec_queue_max_default")]
pub exec_queue_max: usize,
}

impl Default for Task {
#[inline]
fn default() -> Self {
Self { exec_workers: Self::exec_workers_default(), exec_queue_max: Self::exec_queue_max_default() }
}
}

impl Task {
fn exec_workers_default() -> usize {
1000
Expand Down

0 comments on commit 61f6ac1

Please sign in to comment.