From bee0e950a558e5384bd365bf83ba9abee0f2c8f3 Mon Sep 17 00:00:00 2001 From: Rushmore Mushambi Date: Fri, 8 Sep 2023 20:24:12 +0200 Subject: [PATCH] Compute local variables before storing them (#2652) --- lib/src/api/engine/local/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/api/engine/local/mod.rs b/lib/src/api/engine/local/mod.rs index e6501346..5cec0cf3 100644 --- a/lib/src/api/engine/local/mod.rs +++ b/lib/src/api/engine/local/mod.rs @@ -655,7 +655,10 @@ async fn router( [Value::Strand(Strand(key)), value] => (mem::take(key), mem::take(value)), _ => unreachable!(), }; - vars.insert(key, value); + match kvs.compute(value, &*session, Some(vars.clone())).await? { + Value::None => vars.remove(&key), + v => vars.insert(key, v), + }; Ok(DbResponse::Other(Value::None)) } Method::Unset => {