Skip to content

Commit

Permalink
Bigger chunks default values
Browse files Browse the repository at this point in the history
  • Loading branch information
scx1332 committed Oct 20, 2023
1 parent 8828d2f commit 4714355
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gvmkit-build"
version = "0.3.14"
version = "0.3.15"
description = "Tool used to build gvmi images used by Golem Network. Companion app to Golem Registry"
authors = ["Golem Factory <contact@golem.network>"]
edition = "2021"
Expand Down
8 changes: 7 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct CmdArgs {
/// lz4 and xz do not support this option
#[arg(help_heading = Some("Image creation"), long)]
compression_level: Option<u32>,
/// Specify chunk size (default 2MB)
/// Specify chunk size (default 2MB, set this value in bytes)
#[arg(help_heading = Some("Portal"), long)]
upload_chunk_size: Option<u64>,
/// Specify number of upload workers (default 4)
Expand Down Expand Up @@ -225,6 +225,12 @@ async fn main() -> anyhow::Result<()> {
let image_file_size = fs::metadata(&path).await?.len();
let chunk_size = if let Some(chunk_size) = cmdargs.upload_chunk_size {
chunk_size
} else if image_file_size > 1024 * 1024 * 1024 * 5 {
100 * 1024 * 1024
} else if image_file_size > 1024 * 1024 * 1024 * 2 {
50 * 1024 * 1024
} else if image_file_size > 1024 * 1024 * 1024 {
20 * 1024 * 1024
} else if image_file_size > 1024 * 1024 * 500 {
10 * 1024 * 1024
} else if image_file_size > 1024 * 1024 * 200 {
Expand Down

0 comments on commit 4714355

Please sign in to comment.