diff options
author | Matthew Gumport <[email protected]> | 2024-08-26 23:58:16 -0700 |
---|---|---|
committer | Edward Wang <[email protected]> | 2024-09-06 13:43:53 -0700 |
commit | 444186eb71aedd374e59b6abcdb2c2ea7ae2e2d2 (patch) | |
tree | 19849944af97dac03d9ff5e1784c846f41f9c083 | |
parent | d1d7a87b761eeb4f71fcaa3f7c4ae8e32f1d93c8 (diff) | |
download | pingora-444186eb71aedd374e59b6abcdb2c2ea7ae2e2d2.tar.gz pingora-444186eb71aedd374e59b6abcdb2c2ea7ae2e2d2.zip |
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.
-rw-r--r-- | .bleep | 2 | ||||
-rw-r--r-- | pingora-cache/src/lib.rs | 5 |
2 files changed, 6 insertions, 1 deletions
@@ -1 +1 @@ -90c70086397a4708a4dadfed6e6915ce6dc33481
\ No newline at end of file +856e8cec6eaf3ad55fd83b85a85591bfd7dbe1dc
\ No newline at end of file diff --git a/pingora-cache/src/lib.rs b/pingora-cache/src/lib.rs index d1346e5..cdcfcc9 100644 --- a/pingora-cache/src/lib.rs +++ b/pingora-cache/src/lib.rs @@ -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), |