Compute local variables before storing them (#2652)

This commit is contained in:
Rushmore Mushambi 2023-09-08 20:24:12 +02:00 committed by GitHub
parent 91cc18c411
commit bee0e950a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 => {