Skip to content

Commit

Permalink
Auto merge of rust-lang#10456 - hi-rustin:rustin-patch-network, r=ale…
Browse files Browse the repository at this point in the history
…xcrichton

Wait up to one second while waiting for curl

### What does this PR try to resolve?

close rust-lang#8516

Wait up to one second while waiting for curl.

### How should we test and review this PR?

1. Build cargo
2. Start a network transfer (cargo fetch).
3. Pull the network cord.
4. Wait.
  • Loading branch information
bors committed Mar 7, 2022
2 parents 865cd5a + b68bf77 commit c5cdd25
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/cargo/core/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1000,11 +1000,9 @@ impl<'a, 'cfg> Downloads<'a, 'cfg> {
break Ok(pair);
}
assert!(!self.pending.is_empty());
let timeout = self
.set
.multi
.get_timeout()?
.unwrap_or_else(|| Duration::new(5, 0));
let min_timeout = Duration::new(1, 0);
let timeout = self.set.multi.get_timeout()?.unwrap_or(min_timeout);
let timeout = timeout.min(min_timeout);
self.set
.multi
.wait(&mut [], timeout)
Expand Down

0 comments on commit c5cdd25

Please sign in to comment.