From 15d1f6516e31d20ab69569b7d6b6589f4d8f4f7b Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 2 Oct 2023 17:55:04 +0200 Subject: async lock mutex in cache --- base/src/cache.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'base/src/cache.rs') diff --git a/base/src/cache.rs b/base/src/cache.rs index ee13b73..86c2379 100644 --- a/base/src/cache.rs +++ b/base/src/cache.rs @@ -46,7 +46,9 @@ where { let (bucket, location) = cache_location(seed); // we need a lock even if it exists since somebody might be still in the process of writing. - let _guard = CACHE_GENERATION_LOCKS[bucket % CACHE_GENERATION_BUCKET_COUNT].lock(); + let _guard = CACHE_GENERATION_LOCKS[bucket % CACHE_GENERATION_BUCKET_COUNT] + .lock() + .await; let exists = tokio::fs::try_exists(location.path()) .await .context("unable to test for cache file existance")?; -- cgit v1.2.3-70-g09d2