Skip to content
Open
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
12 changes: 12 additions & 0 deletions magic-nix-cache/src/gha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,18 @@ async fn upload_path(
// Upload the NAR.
let nar_path = format!("{}.nar.zstd", path_info.nar_hash.to_base32());

// This limit was chosen arbitrarily, to reduce the chances of hitting GHA
// cache API limits. An even better filter would be “cost of rebuilding
// this derivation”, but that metric is not readily available.
if path_info.nar_size < 5000 {
tracing::debug!(
"Skipping small file '{}' ({}b)",
nar_path,
path_info.nar_size
);
return Ok(());
}

let nar_allocation = api.allocate_file_with_random_suffix(&nar_path).await?;

let nar_stream = store.nar_from_path(path.clone());
Expand Down