Skip to content

Commit

Permalink
Don't block async future when enumerating stones
Browse files Browse the repository at this point in the history
  • Loading branch information
tarkah committed Nov 19, 2024
1 parent 5e33c59 commit 5601413
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/vessel/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ async fn handle_message(state: &State, message: Message) -> Result<()> {
async move {
info!("Import started");

let stones = enumerate_stones(&directory).context("enumerate stones")?;
let stones = tokio::task::spawn_blocking(move || enumerate_stones(&directory))
.await
.context("spawn blocking")?
.context("enumerate stones")?;

let num_stones = stones.len();

if num_stones > 0 {
Expand Down

0 comments on commit 5601413

Please sign in to comment.