diff --git a/crates/shared/src/request_sharing.rs b/crates/shared/src/request_sharing.rs
index d36dc7f4ce..c2d1b38f60 100644
--- a/crates/shared/src/request_sharing.rs
+++ b/crates/shared/src/request_sharing.rs
@@ -73,6 +73,15 @@ where
}
}
+impl Drop for RequestSharing {
+ fn drop(&mut self) {
+ let cache = self.in_flight.lock().unwrap();
+ Metrics::get()
+ .request_sharing_cached_items
+ .sub(cache.len() as u64);
+ }
+}
+
/// Returns a shallow copy (without any pending requests)
impl Clone for RequestSharing {
fn clone(&self) -> Self {