From 6e4ea7c72c9ec87218a05f493aadfeb7a07c3f9d Mon Sep 17 00:00:00 2001 From: Gabor Gevay Date: Fri, 16 Feb 2024 15:25:24 +0100 Subject: [PATCH] Fix `set_read_policy` also in the Compute controller Similar to d3feba8c6f3403be78f251a4d4a9ee6dd50b8da1 --- src/compute-client/src/controller/instance.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/compute-client/src/controller/instance.rs b/src/compute-client/src/controller/instance.rs index dcf7a42deee84..bd0445760e035 100644 --- a/src/compute-client/src/controller/instance.rs +++ b/src/compute-client/src/controller/instance.rs @@ -1195,10 +1195,11 @@ where let old_capability = &collection.implied_capability; let new_capability = new_policy.frontier(collection.write_frontier.borrow()); if PartialOrder::less_than(old_capability, &new_capability) { - let mut update = ChangeBatch::new(); - update.extend(old_capability.iter().map(|t| (t.clone(), -1))); - update.extend(new_capability.iter().map(|t| (t.clone(), 1))); - read_capability_changes.insert(id, update); + let entry = read_capability_changes + .entry(id) + .or_insert_with(ChangeBatch::new); + entry.extend(old_capability.iter().map(|t| (t.clone(), -1))); + entry.extend(new_capability.iter().map(|t| (t.clone(), 1))); collection.implied_capability = new_capability; }