Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions src/forge/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ use super::rate_limit::RateLimiter;

const DEFAULT_BASE_URL: &str = "https://forge.sp-tarkov.com/api/v0";
const MAX_RETRIES: u32 = 3;
const MAX_DOWNLOAD_SIZE: u64 = 500 * 1024 * 1024; // 500 MB

#[cfg(test)]
const EXTERNAL_READ_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(3);
#[cfg(not(test))]
Expand Down Expand Up @@ -373,14 +371,6 @@ impl ForgeClient {
.context("download_file returned error status")?;

let total_size = resp.content_length();
if let Some(size) = total_size {
anyhow::ensure!(
size <= MAX_DOWNLOAD_SIZE,
"download too large ({:.0} MB, limit {:.0} MB)",
size as f64 / (1024.0 * 1024.0),
MAX_DOWNLOAD_SIZE as f64 / (1024.0 * 1024.0)
);
}
let mut stream = resp.bytes_stream();
let mut file = tokio::fs::File::create(dest)
.await
Expand All @@ -396,11 +386,6 @@ impl ForgeClient {
.await
.context("error writing to file")?;
downloaded += bytes.len() as u64;
anyhow::ensure!(
downloaded <= MAX_DOWNLOAD_SIZE,
"download exceeded size limit ({:.0} MB)",
MAX_DOWNLOAD_SIZE as f64 / (1024.0 * 1024.0)
);

if last_log.elapsed() >= std::time::Duration::from_secs(10) {
last_log = std::time::Instant::now();
Expand Down
Loading