Skip to content

Commit

Permalink
unset meta on cache miss
Browse files Browse the repository at this point in the history
If we have a cache miss, any meta in this object is invalid. Unset
it so that we don't use it later.
  • Loading branch information
gumpt authored and drcaramelsyrup committed Sep 6, 2024
1 parent d1d7a87 commit 444186e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .bleep
Original file line number Diff line number Diff line change
@@ -1 +1 @@
90c70086397a4708a4dadfed6e6915ce6dc33481
856e8cec6eaf3ad55fd83b85a85591bfd7dbe1dc
5 changes: 5 additions & 0 deletions pingora-cache/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 444186e

Please sign in to comment.