Browse Source

add timeouts to download request

feat/mass-publish-tool
Jonathan Strong 11 months ago
parent
commit
2c83cd14c5
  1. 5
      src/main.rs

5
src/main.rs

@ -15,6 +15,7 @@ use governor::{Quota, RateLimiter};
use reqwest::header::AUTHORIZATION; // ACCEPT, CONTENT_TYPE};
use serde::Deserialize;
use tokio::io::AsyncBufReadExt;
use tokio::time::timeout;
use tracing::{debug, error, info, warn};
use tracing_subscriber::filter::EnvFilter;
@ -683,9 +684,9 @@ async fn download_versions(
req
};
let resp = req.send().await?;
let resp = timeout(Duration::from_secs(10), req.send()).await??;
let status = resp.status();
let body = resp.bytes().await?;
let body = timeout(Duration::from_secs(10), resp.bytes()).await??;
if !status.is_success() {
error!(status = ?status, "download failed");

Loading…
Cancel
Save