Skip to content

Commit 1cabebd

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

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/dist/manifestation.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -284,28 +284,30 @@ impl Manifestation {
284284
let (component, format, installer_file) = message?;
285285
let component_name = component.short_name(&new_manifest);
286286
let notify_handler = Arc::clone(&download_cfg.notify_handler);
287-
let new_tx = {
287+
current_tx = tokio::task::spawn_blocking({
288288
let this = Arc::clone(&self);
289289
let new_manifest = Arc::clone(&new_manifest);
290290
let tmp_cx = Arc::clone(&download_cfg.tmp_cx);
291291
let download_cfg = Arc::clone(&download_cfg);
292-
let download_cfg = (&*download_cfg).into();
293-
this.install_component(
294-
component,
295-
format,
296-
installer_file,
297-
tmp_cx,
298-
download_cfg,
299-
new_manifest,
300-
current_tx,
301-
)
302-
};
292+
move || {
293+
let download_cfg = (&*download_cfg).into();
294+
this.install_component(
295+
component,
296+
format,
297+
installer_file,
298+
tmp_cx,
299+
download_cfg,
300+
new_manifest,
301+
current_tx,
302+
)
303+
}
304+
})
305+
.await??;
303306
(notify_handler)(Notification::ComponentInstalled(
304307
&component_name,
305308
&self.target_triple,
306309
Some(&self.target_triple),
307310
));
308-
current_tx = new_tx?;
309311
counter += 1;
310312
}
311313
Ok::<_, Error>(current_tx)

0 commit comments

Comments
 (0)