From 8f6e96e9898146512457be1ceb467996ab683d5f Mon Sep 17 00:00:00 2001 From: Kinesin Data Technologies Incorporated <93931750+kinesintech@users.noreply.github.com> Date: Wed, 5 Oct 2022 12:29:20 -0300 Subject: [PATCH] Adding in a force-recheck option --- src/bin/wf/main.rs | 5 +++++ src/runner.rs | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/bin/wf/main.rs b/src/bin/wf/main.rs index 0380084..77631d6 100644 --- a/src/bin/wf/main.rs +++ b/src/bin/wf/main.rs @@ -75,6 +75,10 @@ struct Args { /// Enable verbose logging #[clap(short, long)] verbose: bool, + + /// Force a full re-check + #[clap(short, long)] + force_recheck: bool, } /* @@ -122,6 +126,7 @@ async fn main() -> std::io::Result<()> { exe_tx.clone(), storage_tx.clone(), world_def.output_options, + args.force_recheck, ) .await .unwrap(); diff --git a/src/runner.rs b/src/runner.rs index 105f90c..c5a963e 100644 --- a/src/runner.rs +++ b/src/runner.rs @@ -214,6 +214,7 @@ impl Runner { executor: mpsc::UnboundedSender, storage: mpsc::UnboundedSender, output_options: TaskOutputOptions, + force_check: bool, ) -> Result { for tdef in tasks.values() { validate_cmd(executor.clone(), tdef.up.clone()).await?; @@ -225,11 +226,15 @@ impl Runner { } } - let (response, rx) = oneshot::channel(); - storage - .send(StorageMessage::LoadState { response }) - .unwrap(); - let current = rx.await.unwrap(); + let current = if force_check { + let (response, rx) = oneshot::channel(); + storage + .send(StorageMessage::LoadState { response }) + .unwrap(); + rx.await.unwrap() + } else { + ResourceInterval::new() + }; let end_state = tasks.coverage()?; let mut runner = Runner { @@ -489,7 +494,7 @@ mod tests { // Storage let (storage_tx, storage_rx) = mpsc::unbounded_channel(); - let storage = redis_store::start( + let storage = storage::redis::start( storage_rx, "redis://localhost".to_owned(), "world_test".to_owned(), @@ -501,6 +506,7 @@ mod tests { tx.clone(), storage_tx.clone(), world_def.output_options, + true, ) .await .unwrap();