Skip to content

Commit c874fd8

Browse files
committed
Increase cache housekeeping interval
1 parent 64ee369 commit c874fd8

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ It supports multiple backends: Azure Blob Storage and local filesystem, to provi
55
It caches the files in a local directory and serves them from there.
66
Range requests are supported, but only for start offset, end limit is not implemented yet.
77
Files are protected by upload locking to prevent concurrent uploads to the same path.
8+
To limit disk usage, a background housekeeping loop samples disk space every five minutes and deletes the oldest cached files (older than an hour) whenever free space drops below 12%.
89

910
## Configuration
1011

docs/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ curl https://files.kernelci.org/metrics
9090

9191
- **JWT Authentication**: Secure token-based authentication for uploads
9292
- **Multiple Storage Backends**: Currently supports Azure Blob Storage with extensible driver architecture
93-
- **Local Caching**: Files are cached locally with automatic cleanup when disk space is low
93+
- **Local Caching**: Files are cached locally with automatic cleanup when disk space is low; disk space is sampled every five minutes and the least recently updated cached files older than an hour are removed until space recovers
9494
- **Range Request Support**: Partial content downloads using HTTP range requests
9595
- **File Locking**: Prevents concurrent uploads to the same file path
9696
- **Prometheus Metrics**: System monitoring and metrics collection

src/storcaching.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ pub async fn cache_loop(cache_dir: &str) {
125125
tokio::time::sleep(Duration::from_millis(100)).await;
126126
} else {
127127
debug_log!("Free disk space: {}%", free_space);
128-
// normal mode, sleep 10 seconds
129-
tokio::time::sleep(Duration::from_secs(10)).await;
128+
// normal mode, sleep 5 minutes between samples
129+
tokio::time::sleep(Duration::from_secs(300)).await;
130130
}
131131
}
132132
}

0 commit comments

Comments
 (0)