aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock1
-rw-r--r--base/Cargo.toml1
-rw-r--r--base/src/cache.rs8
3 files changed, 8 insertions, 2 deletions
diff --git a/Cargo.lock b/Cargo.lock
index ed04edd..fbfec3f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1712,6 +1712,7 @@ dependencies = [
"anyhow",
"base64",
"bincode",
+ "humansize",
"jellyclient",
"jellycommon",
"log",
diff --git a/base/Cargo.toml b/base/Cargo.toml
index e897404..6474e25 100644
--- a/base/Cargo.toml
+++ b/base/Cargo.toml
@@ -19,6 +19,7 @@ redb = "2.4.0"
tantivy = "0.22.0"
serde_json = "1.0.138"
aes-gcm-siv = "0.11.1"
+humansize = "2.1.3"
[features]
db_json = []
diff --git a/base/src/cache.rs b/base/src/cache.rs
index d6aa15f..0b28e1b 100644
--- a/base/src/cache.rs
+++ b/base/src/cache.rs
@@ -44,7 +44,8 @@ pub fn cache_location(seed: &[&str]) -> (usize, CachePath) {
d.update(b"\0");
}
let d = d.finalize();
- let n = d[0] as usize | ((d[1] as usize) << 8) | ((d[2] as usize) << 16) | ((d[3] as usize) << 24);
+ let n =
+ d[0] as usize | ((d[1] as usize) << 8) | ((d[2] as usize) << 16) | ((d[3] as usize) << 24);
let fname = base64::engine::general_purpose::URL_SAFE.encode(d);
let fname = &fname[..22];
let fname = format!("{}-{}", seed[0], fname); // about 128 bits
@@ -269,5 +270,8 @@ pub fn cleanup_cache() {
CACHE_IN_MEMORY_SIZE.fetch_sub(reduction, Ordering::Relaxed);
drop(g);
- info!("done");
+ info!(
+ "done, {} freed",
+ humansize::format_size(reduction, humansize::DECIMAL)
+ );
}