Skip to content

Commit

Permalink
Add option to disable database concurrency
Browse files Browse the repository at this point in the history
  • Loading branch information
kpcyrd committed Oct 30, 2024
1 parent 7f9cb93 commit 3ac1f89
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ pub struct Args {
#[clap(long = "skip-cache")]
/// Do not read from disk cache for Debian database results
pub skip_cache: bool,
#[clap(long = "concurrency", short = 'j', default_value = "24")]
/// How many database connections to use concurrently
pub concurrency: usize,
#[clap(long = "no-dev-dependencies")]
/// Skip dev dependencies.
pub no_dev_dependencies: bool,
Expand Down
4 changes: 1 addition & 3 deletions src/debian.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ use semver::Version;
use std::path::PathBuf;
use std::thread;

const QUERY_THREADS: usize = 24;

#[derive(Debug, Clone)]
pub struct Pkg {
pub id: PackageId,
Expand Down Expand Up @@ -160,7 +158,7 @@ pub fn populate(graph: &mut Graph, args: &Args) -> Result<(), Error> {
let (return_tx, return_rx) = crossbeam_channel::unbounded();

info!("Creating thread-pool");
for _ in 0..QUERY_THREADS {
for _ in 0..args.concurrency {
let args = args.clone();
let task_rx = task_rx.clone();
let return_tx = return_tx.clone();
Expand Down

0 comments on commit 3ac1f89

Please sign in to comment.