Skip to main content

trim

Function trim 

Source
pub async fn trim(
    directory: &Path,
    max_bytes: u64,
    unused: Duration,
) -> Result<u64>
Expand description

Deletes what an abandoned upload left, then the oldest files until the directory fits max_bytes.

The upload endpoint is public, so it cannot rely on a scheduled cleanup alone: a burst of uploads with no visitor would otherwise fill the disk between runs. Deletion is oldest first, which keeps the newest files — the ones a browser is still working with — longest.