aboutsummaryrefslogtreecommitdiffstats
path: root/crates/rule-executor/src/processor/rule
diff options
context:
space:
mode:
authorrtkay123 <dev@kanjala.com>2025-08-16 00:17:07 +0200
committerrtkay123 <dev@kanjala.com>2025-08-16 00:17:19 +0200
commit4a82b6db8a1278588b97b874bad468ec6f7cda6c (patch)
treeec1ac9e3725a6db9d3cc952f44b4d2dca4e491f4 /crates/rule-executor/src/processor/rule
parent4e31b25854e015e089c0abd4e5c61ee3de4bfc8a (diff)
downloadwarden-4a82b6db8a1278588b97b874bad468ec6f7cda6c.tar.bz2
warden-4a82b6db8a1278588b97b874bad468ec6f7cda6c.zip
fix(exec): cache lock
Diffstat (limited to 'crates/rule-executor/src/processor/rule')
-rw-r--r--crates/rule-executor/src/processor/rule/configuration.rs10
1 files changed, 7 insertions, 3 deletions
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<RuleConfiguration> {
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)
}