unset meta on cache miss

If we have a cache miss, any meta in this object is invalid. Unset
it so that we don't use it later.
This commit is contained in:
Matthew Gumport 2024-08-26 23:58:16 -07:00 committed by Edward Wang
parent d1d7a87b76
commit 444186eb71
2 changed files with 6 additions and 1 deletions

2
.bleep
View file

@ -1 +1 @@
90c70086397a4708a4dadfed6e6915ce6dc33481
856e8cec6eaf3ad55fd83b85a85591bfd7dbe1dc

View file

@ -499,6 +499,11 @@ impl HttpCache {
// from Stale: waited for cache lock, then retried and found asset was gone
CachePhase::CacheKey | CachePhase::Bypass | CachePhase::Stale => {
self.phase = CachePhase::Miss;
// It's possible that we've set the meta on lookup and have come back around
// here after not being able to acquire the cache lock, and our item has since
// purged or expired. We should be sure that the meta is not set in this case
// as there shouldn't be a meta set for cache misses.
self.inner_mut().meta = None;
self.inner_mut().traces.start_miss_span();
}
_ => panic!("wrong phase {:?}", self.phase),