From 4a82b6db8a1278588b97b874bad468ec6f7cda6c Mon Sep 17 00:00:00 2001 From: rtkay123 Date: Sat, 16 Aug 2025 00:17:07 +0200 Subject: fix(exec): cache lock --- crates/rule-executor/src/processor/rule/configuration.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'crates/rule-executor/src/processor/rule') diff --git a/crates/rule-executor/src/processor/rule/configuration.rs b/crates/rule-executor/src/processor/rule/configuration.rs index 6e11248..5f384aa 100644 --- a/crates/rule-executor/src/processor/rule/configuration.rs +++ b/crates/rule-executor/src/processor/rule/configuration.rs @@ -10,8 +10,10 @@ pub(super) async fn get_configuration( state: AppHandle, ) -> Result { trace!("checking cache for rule configuration"); - let cache = state.local_cache.read().await; - let config = cache.get(&request).await; + let config = { + let cache = state.local_cache.read().await; + cache.get(&request).await + }; if let Some(config) = config { trace!("cache hit"); return Ok(config); @@ -35,8 +37,10 @@ pub(super) async fn get_configuration( .configuration .ok_or_else(|| anyhow!("missing configuration"))?; - let mut cache = state.local_cache.write().await; + println!("inserting"); + let cache = state.local_cache.write().await; cache.insert(request, config.clone()).await; + println!("inserted"); Ok(config) } -- cgit v1.2.3