Skip to content

Commit

Permalink
chore(miner): abort all tasks if any fails
Browse files Browse the repository at this point in the history
  • Loading branch information
cfcosta committed Aug 30, 2023
1 parent f721d17 commit 0757883
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/cmd/mine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,18 @@ pub async fn thing() -> miette::Result<()> {
});
}

while let Some(new_datum) = rx.recv().await {}
tasks.spawn(async move {
while let Some(new_datum) = rx.recv().await {
todo!();
}

Ok(())
});

if let Some(_) = tasks.join_next().await {
// If any task finishes for some reason, we drop all of them cleanly.
tasks.abort_all();
}

Ok(())
}
Expand Down

0 comments on commit 0757883

Please sign in to comment.