Skip to content

Commit

Permalink
Merge pull request #59 from SRVng/gh-59-default-worker
Browse files Browse the repository at this point in the history
Default `num_workers` to `num_cpus`
  • Loading branch information
film42 authored Jan 29, 2025
2 parents 139f85e + 78e3492 commit c80f667
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub struct Processor {
config: ProcessorConfig,
}

#[derive(Default, Clone)]
#[derive(Clone)]
#[non_exhaustive]
pub struct ProcessorConfig {
/// The number of Sidekiq workers that can run at the same time. Adjust as needed based on
Expand Down Expand Up @@ -102,6 +102,16 @@ impl ProcessorConfig {
}
}

impl Default for ProcessorConfig {
fn default() -> Self {
Self {
num_workers: num_cpus::get(),
balance_strategy: Default::default(),
queue_configs: Default::default(),
}
}
}

impl QueueConfig {
#[must_use]
pub fn num_workers(mut self, num_workers: usize) -> Self {
Expand Down

0 comments on commit c80f667

Please sign in to comment.