Skip to content

Commit

Permalink
fix(rpc/eth): remove cache when reorg occured (paradigmxyz#9775)
Browse files Browse the repository at this point in the history
Signed-off-by: jsvisa <[email protected]>
  • Loading branch information
jsvisa authored Jul 24, 2024
1 parent 6b1fbf8 commit 7531366
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions crates/rpc/rpc-eth-types/src/cache/multi_consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,12 @@ where
}
}

/// Remove consumers for a given key.
/// Remove consumers for a given key, this will also remove the key from the cache.
pub fn remove(&mut self, key: &K) -> Option<Vec<S>> {
match self.queued.remove(key) {
Some(removed) => {
self.metrics.queued_consumers_count.decrement(removed.len() as f64);
Some(removed)
}
None => None,
}
let _ = self.cache.remove(key);
self.queued
.remove(key)
.inspect(|removed| self.metrics.queued_consumers_count.decrement(removed.len() as f64))
}

/// Returns a reference to the value for a given key and promotes that element to be the most
Expand Down

0 comments on commit 7531366

Please sign in to comment.