From 8560c0b3a6745cf1b5c82c1be862e0f3a9425723 Mon Sep 17 00:00:00 2001 From: EETagent Date: Wed, 16 Nov 2022 16:39:24 +0100 Subject: [PATCH] fix: do not remove cache dir completely --- core/src/services/candidate_service.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/services/candidate_service.rs b/core/src/services/candidate_service.rs index 44a4045..6a24241 100644 --- a/core/src/services/candidate_service.rs +++ b/core/src/services/candidate_service.rs @@ -159,7 +159,9 @@ impl CandidateService { pub async fn delete_cache(candidate_id: i32) -> Result<(), ServiceError> { let cache_path = Path::new(&candidate_id.to_string()).join("cache"); - tokio::fs::remove_dir_all(cache_path).await?; + tokio::fs::remove_dir_all(&cache_path).await?; + // Recreate blank cache directory + tokio::fs::create_dir_all(&cache_path).await?; Ok(()) }