Skip to content

Commit

Permalink
change to option
Browse files Browse the repository at this point in the history
  • Loading branch information
tyurek committed Dec 12, 2024
1 parent aba36f8 commit 53b6198
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions ipa-core/src/bin/report_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ enum ReportCollectorCommand {

// If set, use the specified fixed polling interval when running a query.
// Otherwise, use exponential backoff.
#[arg(long, default_value_t = 0)]
set_fixed_polling_ms: u64,
#[clap(long)]
set_fixed_polling_ms: Option<u64>,
},
}

Expand Down Expand Up @@ -428,7 +428,7 @@ async fn hybrid(
helper_clients: Vec<[IpaHttpClient<Helper>; 3]>,
encrypted_inputs: &EncryptedInputs,
count: usize,
set_fixed_polling_ms: u64,
set_fixed_polling_ms: Option<u64>,
) -> Result<(), Box<dyn Error>> {
let query_type = QueryType::MaliciousHybrid(hybrid_query_config);

Expand Down
11 changes: 5 additions & 6 deletions ipa-core/src/cli/playbook/hybrid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub async fn run_hybrid_query_and_validate<HV>(
clients: Vec<[IpaHttpClient<Helper>; 3]>,
query_id: QueryId,
query_config: HybridQueryParams,
set_fixed_polling_ms: u64,
set_fixed_polling_ms: Option<u64>,
) -> HybridQueryResult
where
HV: SharedValue + U128Conversions,
Expand All @@ -56,11 +56,10 @@ where
.unwrap();

let leader_clients = &clients[0];
let exponential_backoff = set_fixed_polling_ms == 0;
let mut delay = if exponential_backoff {
Duration::from_millis(125)
} else {
Duration::from_millis(set_fixed_polling_ms)

let (exponential_backoff, mut delay) = match set_fixed_polling_ms {
Some(specified_delay) => (false, Duration::from_millis(specified_delay)),
None => (true, Duration::from_millis(125)),
};

loop {
Expand Down

0 comments on commit 53b6198

Please sign in to comment.