From f17a585b563d874ef9a09c27be5169b7e728d148 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Sat, 20 Dec 2025 19:48:40 +1100 Subject: [PATCH] fix: limit chunks to 512 files each --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/manifest.rs | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e6dcc97..7fff647 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -219,7 +219,7 @@ dependencies = [ [[package]] name = "droplet-rs" -version = "0.14.0" +version = "0.14.1" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 4e609c4..104c576 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/manifest.rs b/src/manifest.rs index 7b66f30..d8f38cd 100644 --- a/src/manifest.rs +++ b/src/manifest.rs @@ -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( 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::(); if version_file.size + current_size < CHUNK_SIZE {