Skip to content

Commit

Permalink
Move updating processed and latest trees to blocking tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Dzejkop committed Apr 23, 2024
1 parent 1a9fb8c commit 4c129c4
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,14 @@ impl App {
.await?;

tracing::info!("Updating processed tree");
for processed_item in processed_items {
processed_builder.update(&processed_item);
}
let processed_builder = tokio::task::spawn_blocking(move || {
for processed_item in processed_items {
processed_builder.update(&processed_item);
}

processed_builder
})
.await?;

let (processed, batching_builder) = processed_builder.seal_and_continue();
let (batching, mut latest_builder) = batching_builder.seal_and_continue();
Expand All @@ -338,9 +343,14 @@ impl App {
.await?;

tracing::info!("Updating latest tree");
for update in pending_items {
latest_builder.update(&update);
}
let latest_builder = tokio::task::spawn_blocking(move || {
for update in pending_items {
latest_builder.update(&update);
}

latest_builder
})
.await?;

let latest = latest_builder.seal();

Expand Down

0 comments on commit 4c129c4

Please sign in to comment.