From b9669aecd9d117238cb733a83299eeac8e3d0b73 Mon Sep 17 00:00:00 2001 From: Bulat Kurbanov Date: Sun, 5 May 2024 20:58:43 +0200 Subject: [PATCH] Fix --- src/views.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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() });