Adding in a force-recheck option

This commit is contained in:
Kinesin Data Technologies Incorporated
2022-10-05 12:29:20 -03:00
parent 56771a5f47
commit 8f6e96e989
2 changed files with 17 additions and 6 deletions
+5
View File
@@ -75,6 +75,10 @@ struct Args {
/// Enable verbose logging /// Enable verbose logging
#[clap(short, long)] #[clap(short, long)]
verbose: bool, 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(), exe_tx.clone(),
storage_tx.clone(), storage_tx.clone(),
world_def.output_options, world_def.output_options,
args.force_recheck,
) )
.await .await
.unwrap(); .unwrap();
+8 -2
View File
@@ -214,6 +214,7 @@ impl Runner {
executor: mpsc::UnboundedSender<ExecutorMessage>, executor: mpsc::UnboundedSender<ExecutorMessage>,
storage: mpsc::UnboundedSender<StorageMessage>, storage: mpsc::UnboundedSender<StorageMessage>,
output_options: TaskOutputOptions, output_options: TaskOutputOptions,
force_check: bool,
) -> Result<Self> { ) -> Result<Self> {
for tdef in tasks.values() { for tdef in tasks.values() {
validate_cmd(executor.clone(), tdef.up.clone()).await?; validate_cmd(executor.clone(), tdef.up.clone()).await?;
@@ -225,11 +226,15 @@ impl Runner {
} }
} }
let current = if force_check {
let (response, rx) = oneshot::channel(); let (response, rx) = oneshot::channel();
storage storage
.send(StorageMessage::LoadState { response }) .send(StorageMessage::LoadState { response })
.unwrap(); .unwrap();
let current = rx.await.unwrap(); rx.await.unwrap()
} else {
ResourceInterval::new()
};
let end_state = tasks.coverage()?; let end_state = tasks.coverage()?;
let mut runner = Runner { let mut runner = Runner {
@@ -489,7 +494,7 @@ mod tests {
// Storage // Storage
let (storage_tx, storage_rx) = mpsc::unbounded_channel(); let (storage_tx, storage_rx) = mpsc::unbounded_channel();
let storage = redis_store::start( let storage = storage::redis::start(
storage_rx, storage_rx,
"redis://localhost".to_owned(), "redis://localhost".to_owned(),
"world_test".to_owned(), "world_test".to_owned(),
@@ -501,6 +506,7 @@ mod tests {
tx.clone(), tx.clone(),
storage_tx.clone(), storage_tx.clone(),
world_def.output_options, world_def.output_options,
true,
) )
.await .await
.unwrap(); .unwrap();