diff --git a/src/views.rs b/src/views.rs index 5a4f864..6fa491c 100644 --- a/src/views.rs +++ b/src/views.rs @@ -26,8 +26,15 @@ use crate::{ pub static TASK_RESULTS: Lazy> = Lazy::new(|| { Cache::builder() - .time_to_idle(Duration::from_secs(12 * 60 * 60)) + .time_to_idle(Duration::from_secs(3 * 60 * 60)) .max_capacity(2048) + .async_eviction_listener(|_key, value: Task, _reason| { + Box::pin(async move { + if let Some(result_filename) = value.result_filename { + let _ = tokio::fs::remove_file(format!("/tmp/{}", result_filename)).await; + } + }) + }) .build() });