Skip to content

Commit

Permalink
Update registry cache
Browse files Browse the repository at this point in the history
improve cache
  • Loading branch information
so-schen committed Nov 11, 2024
1 parent 5270249 commit 8a948e3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions types/src/state_store/state_key/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,13 @@ where
fn maybe_remove(&self, key1: &Key1, key2: &Key2) {
let mut locked = self.inner.write();
if let Some(map2) = locked.get_mut(key1) {
map2.remove(key2);
if map2.is_empty() {
locked.remove(key1);
if let Some(entry) = map2.get(key2) {
if entry.strong_count() == 0 {
map2.remove(key2);
if map2.is_empty() {
locked.remove(key1);
}
}
}
}
}
Expand Down

0 comments on commit 8a948e3

Please sign in to comment.