From 12b0feba96798ad332ea23e49de671c958021dea Mon Sep 17 00:00:00 2001 From: Zynh Ludwig Date: Thu, 14 Nov 2024 19:27:19 -0800 Subject: [PATCH] feat: clone cache to drop guard before writing to file cache --- src/router/upload.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/router/upload.rs b/src/router/upload.rs index 3620081..99e9354 100644 --- a/src/router/upload.rs +++ b/src/router/upload.rs @@ -78,7 +78,11 @@ async fn upload_to_zip( let record = UploadRecord::new(archive_path); records.insert(cache_name.clone(), record.clone()); - cache::write_to_cache(&records) + let records_cache = records.clone(); + // Manually drop the records mutex guard + drop(records); + + cache::write_to_cache(&records_cache) .await .map_err(|err| (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()))?;