Skip to content

Commit

Permalink
Only write cache metadata on debug builds (#1297)
Browse files Browse the repository at this point in the history
This should cut the number of files that are written on production builds in half, reducing pressure on the cleanup job.
  • Loading branch information
Swatinem authored Sep 13, 2023
1 parent afbb897 commit b2c603f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions crates/symbolicator-service/src/caching/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,13 @@ impl<T: CacheItemRequest> Cacher<T> {

persist_tempfile(temp_file, &cache_path)?;

// NOTE: we only create the metadata file once, but do not regularly touch it for now
cache_path.set_extension("txt");
if let Err(err) = std::fs::write(cache_path, key.metadata()) {
tracing::error!(error = &err as &dyn std::error::Error);
#[cfg(debug_assertions)]
{
// NOTE: we only create the metadata file once, but do not regularly touch it for now
cache_path.set_extension("txt");
if let Err(err) = std::fs::write(cache_path, key.metadata()) {
tracing::error!(error = &err as &dyn std::error::Error);
}
}
};

Expand Down

0 comments on commit b2c603f

Please sign in to comment.