Skip to content

Commit 1830dcb

Browse files
feat(downloads): use spawn_blocking to allow the downloads to continue during installations
Co-authored-by: rami3l <[email protected]>
1 parent 180008e commit 1830dcb

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/dist/manifestation.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -295,18 +295,21 @@ impl Manifestation {
295295
&& let Some(message) = download_rx.recv().await
296296
{
297297
let (component_bin, installer_file) = message?;
298-
current_tx = {
298+
current_tx = tokio::task::spawn_blocking({
299299
let this = Arc::clone(&self);
300300
let new_manifest = Arc::clone(&new_manifest);
301301
let download_cfg = Arc::clone(&download_cfg);
302-
this.install_component(
303-
component_bin,
304-
installer_file,
305-
download_cfg,
306-
new_manifest,
307-
current_tx,
308-
)
309-
}?;
302+
move || {
303+
this.install_component(
304+
component_bin,
305+
installer_file,
306+
download_cfg,
307+
new_manifest,
308+
current_tx,
309+
)
310+
}
311+
})
312+
.await??;
310313
counter += 1;
311314
}
312315
Ok::<_, Error>(current_tx)

0 commit comments

Comments
 (0)