mirror of
https://github.com/vhaudiquet/ecrou.git
synced 2026-11-12 22:22:44 +00:00
fix(download): drop the total request timeout from transfers
The 300 s client timeout covered the whole body stream, so any download slower than a couple of MB/s died mid-transfer. Connect and per-read windows catch dead peers and stalls instead; slow transfers now finish.
This commit is contained in:
1 parent
8ceab3130d
commit
6835056be9
1 file changed
+10
-2
@@ -268,8 +268,12 @@ async fn download_file_async(
|
||||
) -> anyhow::Result<()> {
|
||||
log::debug!("Downloading: {}", url);
|
||||
|
||||
// No total timeout: a slow transfer of any size must finish. The
|
||||
// connect window and the per-read window catch dead peers and
|
||||
// stalled streams instead.
|
||||
let client = Client::builder()
|
||||
.timeout(Duration::from_secs(300))
|
||||
.connect_timeout(Duration::from_secs(30))
|
||||
.read_timeout(Duration::from_secs(60))
|
||||
.build()
|
||||
.context("Failed to create HTTP client")?;
|
||||
|
||||
@@ -349,8 +353,12 @@ async fn download_oci_image_async(
|
||||
dest: &Path,
|
||||
progress: &dyn Progress,
|
||||
) -> anyhow::Result<()> {
|
||||
// No total timeout: a slow transfer of any size must finish. The
|
||||
// connect window and the per-read window catch dead peers and
|
||||
// stalled streams instead.
|
||||
let client = Client::builder()
|
||||
.timeout(Duration::from_secs(300))
|
||||
.connect_timeout(Duration::from_secs(30))
|
||||
.read_timeout(Duration::from_secs(60))
|
||||
.build()
|
||||
.context("Failed to create HTTP client")?;
|
||||
|
||||
|
||||
Reference in new issue
Block a user