mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
fix(rpc/eth): remove cache when reorg occured (#9775)
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user