Allow the lookup_duration to be read

This commit is contained in:
Yuchen Wu 2024-05-17 09:52:18 -07:00
parent 382cf87141
commit 393ff19162
2 changed files with 8 additions and 2 deletions

2
.bleep
View file

@ -1 +1 @@
ce62ef5259bbe34107ad85f6f5557cda0d53764f
1819510ea4b2b82f5fbf71bae17479f0287b7824

View file

@ -222,7 +222,7 @@ struct HttpCacheInner {
pub lock: Option<Locked>, // TODO: these 3 fields should come in 1 sub struct
pub cache_lock: Option<&'static CacheLock>,
pub lock_duration: Option<Duration>,
/// time spent in cache lookup and reading the header
// time spent in cache lookup and reading the header
pub lookup_duration: Option<Duration>,
pub traces: trace::CacheTraceCTX,
}
@ -1048,6 +1048,12 @@ impl HttpCache {
self.inner.as_ref().and_then(|i| i.lock_duration)
}
/// How long did this request spent on cache lookup and reading the header
pub fn lookup_duration(&self) -> Option<Duration> {
// FIXME: this duration is lost when cache is disabled
self.inner.as_ref().and_then(|i| i.lookup_duration)
}
/// Delete the asset from the cache storage
/// # Panic
/// Need to be called after the cache key is set. Panic otherwise.