Skip to content

Commit dca4f72

Browse files
committed
refactor: rename num_channels to concurrent_downloads
1 parent ab3bfb4 commit dca4f72

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/cli/rustup_mode.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -802,14 +802,14 @@ 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 num_channels = cfg.process.concurrent_downloads().unwrap_or(channels_len);
805+
let concurrent_downloads = cfg.process.concurrent_downloads().unwrap_or(channels_len);
806806

807807
// Ensure that `.buffered()` is never called with 0 as this will cause a hang.
808808
// See: https://github.com/rust-lang/futures-rs/pull/1194#discussion_r209501774
809809
if channels_len > 0 {
810810
let multi_progress_bars =
811811
MultiProgress::with_draw_target(cfg.process.progress_draw_target());
812-
let semaphore = Arc::new(Semaphore::new(num_channels));
812+
let semaphore = Arc::new(Semaphore::new(concurrent_downloads));
813813
let channels = tokio_stream::iter(channels.into_iter()).map(|(name, distributable)| {
814814
let pb = multi_progress_bars.add(ProgressBar::new(1));
815815
pb.set_style(
@@ -878,7 +878,10 @@ async fn check_updates(cfg: &Cfg<'_>, opts: CheckOpts) -> Result<utils::ExitCode
878878
.collect::<Vec<_>>()
879879
.await
880880
} else {
881-
channels.buffered(num_channels).collect::<Vec<_>>().await
881+
channels
882+
.buffered(concurrent_downloads)
883+
.collect::<Vec<_>>()
884+
.await
882885
};
883886

884887
let t = cfg.process.stdout().terminal(cfg.process);

src/dist/manifestation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl Manifestation {
157157
let mut things_downloaded: Vec<String> = Vec::new();
158158
let components = update.components_urls_and_hashes(new_manifest)?;
159159
let components_len = components.len();
160-
let num_channels = download_cfg
160+
let concurrent_downloads = download_cfg
161161
.process
162162
.concurrent_downloads()
163163
.unwrap_or(components_len);
@@ -180,7 +180,7 @@ impl Manifestation {
180180
));
181181
}
182182

183-
let semaphore = Arc::new(Semaphore::new(num_channels));
183+
let semaphore = Arc::new(Semaphore::new(concurrent_downloads));
184184
let component_stream =
185185
tokio_stream::iter(components.into_iter()).map(|(component, format, url, hash)| {
186186
let sem = semaphore.clone();

0 commit comments

Comments
 (0)