Skip to content

Commit 8822424

Browse files
committed
feat(cli/rustup-mode): check updates for all channels unless RUSTUP_CONCURRENT_DOWNLOADS is set to 1
1 parent dca4f72 commit 8822424

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/cli/rustup_mode.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,13 @@ async fn check_updates(cfg: &Cfg<'_>, opts: CheckOpts) -> Result<utils::ExitCode
802802
let mut update_available = false;
803803
let channels = cfg.list_channels()?;
804804
let channels_len = channels.len();
805-
let concurrent_downloads = cfg.process.concurrent_downloads().unwrap_or(channels_len);
805+
806+
// Check updates for all channels unless `RUSTUP_CONCURRENT_DOWNLOADS` is set to 1,
807+
// since the overhead of spawning many concurrent tasks here is acceptable.
808+
let concurrent_downloads = match cfg.process.concurrent_downloads() {
809+
Some(1) => 1,
810+
Some(_) | None => channels_len,
811+
};
806812

807813
// Ensure that `.buffered()` is never called with 0 as this will cause a hang.
808814
// See: https://github.com/rust-lang/futures-rs/pull/1194#discussion_r209501774

0 commit comments

Comments
 (0)