Skip to main content

effective_max_concurrent_delete_jobs

Function effective_max_concurrent_delete_jobs 

Source
pub fn effective_max_concurrent_delete_jobs(
    spec: Option<&ConcurrencySpec>,
) -> NonZeroUsize
Expand description

The effective per-repository cap on live snapshot-delete batch Jobs: concurrency.maxConcurrentDeleteJobs when set, else DEFAULT_MAX_CONCURRENT_DELETE_JOBS (1). Unlike effective_max_concurrent_jobs there is NO uncapped state: parallel bulk deletes against one repository only multiply index loads (issue #477). An explicit 0 is refused at admission; should one reach the controller anyway it also resolves to the default rather than to “delete nothing, forever”.

use kopiur_api::common::ConcurrencySpec;
use kopiur_api::consts::effective_max_concurrent_delete_jobs;

assert_eq!(effective_max_concurrent_delete_jobs(None).get(), 1);
let two = ConcurrencySpec { max_concurrent_delete_jobs: Some(2), ..Default::default() };
assert_eq!(effective_max_concurrent_delete_jobs(Some(&two)).get(), 2);