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 /pingora-cache | |
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.
Diffstat (limited to 'pingora-cache')
-rw-r--r-- | pingora-cache/src/lib.rs | 5 |
1 files changed, 5 insertions, 0 deletions
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), |