fix: limit chunks to 512 files each

This commit is contained in:
DecDuck
2025-12-20 19:48:40 +11:00
parent 9f23190ba2
commit f17a585b56
3 changed files with 11 additions and 3 deletions

2
Cargo.lock generated
View File

@@ -219,7 +219,7 @@ dependencies = [
[[package]]
name = "droplet-rs"
version = "0.14.0"
version = "0.14.1"
dependencies = [
"anyhow",
"async-trait",

View File

@@ -2,7 +2,7 @@
edition = "2021"
authors = ["Drop-OSS"]
name = "droplet-rs"
version = "0.14.0"
version = "0.14.1"
license = "AGPL-3.0-only"
description = "Droplet is a `napi.rs` Rust/Node.js package full of high-performance and low-level utils for Drop"

View File

@@ -41,7 +41,7 @@ pub struct Manifest {
}
const CHUNK_SIZE: u64 = 1024 * 1024 * 64;
const WIGGLE: u64 = 1024 * 1024;
const MAX_FILE_COUNT: usize = 512;
use crate::versions::{create_backend_constructor, types::VersionFile};
@@ -85,10 +85,18 @@ pub async fn generate_manifest_rusty<T: Fn(String), V: Fn(f32)>(
chunks.push(new_chunk);
}
if current_chunk.len() >= MAX_FILE_COUNT {
chunks.push(std::mem::take(&mut current_chunk));
}
continue;
}
} else {
for version_file in files {
if current_chunk.len() >= MAX_FILE_COUNT {
chunks.push(std::mem::take(&mut current_chunk));
}
let current_size = current_chunk.iter().map(|v| v.2).sum::<u64>();
if version_file.size + current_size < CHUNK_SIZE {