Tree::fetch_update: Do not remove and re-add entries.

Better cloning the value than writing another entry!
This commit is contained in:
ppom 2025-08-08 12:00:00 +02:00
commit 10bd0a1859
No known key found for this signature in database
2 changed files with 2 additions and 1 deletions

1
TODO
View file

@ -6,3 +6,4 @@ should an ipv6-mapped ipv4 match a pattern of type ipv6?
should it be normalized as ipv4 then?
fix filter commands executing before start commands
fix order of db write subject to race condition (make writes async?)

View file

@ -364,7 +364,7 @@ impl<K: KeyType, V: ValueType> Tree<K, V> {
key: K,
mut f: F,
) -> Option<V> {
let old_value = self.remove(&key);
let old_value = self.get(&key).map(|v| v.to_owned());
let new_value = f(old_value);
self.log(&key, new_value.as_ref());
if let Some(new_value) = new_value {