diff --git a/batch_resolve.toml b/batch_resolve.toml index d09453c..0fa62b7 100644 --- a/batch_resolve.toml +++ b/batch_resolve.toml @@ -9,3 +9,6 @@ dns = [ # Times to retry on connection timeout retry = 5 + +# Number of async tasks in execution buffer +parallel_tasks = 1000 \ No newline at end of file diff --git a/src/config.rs b/src/config.rs index a2dac3f..a7f3206 100644 --- a/src/config.rs +++ b/src/config.rs @@ -19,15 +19,6 @@ lazy_static! { pub static ref CONFIG: StaticWrapper = StaticWrapper(Config::new()); } -macro_rules! uncell { - ($expr:expr) => (*$expr.borrow()) -} - -macro_rules! uncell_mut { - ($expr:expr) => (*$expr.borrow_mut()) -} - - #[derive(Clone, Debug)] pub struct Config { dns_servers: RefCell>>, @@ -79,6 +70,10 @@ impl Config { if let Some(retry) = cfg_fmt.retry { uncell_mut!(self.timeout_retries) = retry; } + + if let Some(par_tasks) = cfg_fmt.parallel_tasks { + uncell_mut!(self.task_buffer_size) = par_tasks; + } Ok(()) } @@ -88,6 +83,7 @@ impl Config { struct ConfigFormat { dns: Option>, retry: Option, + parallel_tasks: Option, } #[derive(Debug)] diff --git a/src/main.rs b/src/main.rs index f14c908..2578f5c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,7 @@ #[macro_use] extern crate lazy_static; #[macro_use] extern crate serde_derive; -#[macro_use] extern crate derive_new; extern crate serde; -extern crate serde_yaml; +extern crate toml; #[macro_use] extern crate log; #[macro_use] extern crate clap;