From b68bf778409a8ec8a6d0f5361832e72586edfbc3 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Fri, 4 Mar 2022 22:06:26 +0800 Subject: [PATCH] Wait up to one second while waiting for curl Signed-off-by: hi-rustin --- src/cargo/core/package.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/cargo/core/package.rs b/src/cargo/core/package.rs index e8685610aeb..ec455531d18 100644 --- a/src/cargo/core/package.rs +++ b/src/cargo/core/package.rs @@ -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)