diff options
author | Edward Wang <[email protected]> | 2024-07-31 17:08:48 -0700 |
---|---|---|
committer | Andrew Hauck <[email protected]> | 2024-08-09 14:30:49 -0700 |
commit | e5fda7c657bbaa532ccbc27b9cf4a9886071abfb (patch) | |
tree | 9dd099a643d2fa9f286327d65707ebd454a6cfe5 /pingora-cache | |
parent | e0ade326ed8dc6b11fa9f2470f8c4b8f56aea32d (diff) | |
download | pingora-e5fda7c657bbaa532ccbc27b9cf4a9886071abfb.tar.gz pingora-e5fda7c657bbaa532ccbc27b9cf4a9886071abfb.zip |
Allow Stale phase in cache_miss
There could be a race condition where a Stale request waiting on cache
lock retries the cache lock and lookup, but enters cache_miss after
finding the asset is no longer present.
Diffstat (limited to 'pingora-cache')
-rw-r--r-- | pingora-cache/src/lib.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pingora-cache/src/lib.rs b/pingora-cache/src/lib.rs index 86cfbdf..a999f7e 100644 --- a/pingora-cache/src/lib.rs +++ b/pingora-cache/src/lib.rs @@ -493,7 +493,8 @@ impl HttpCache { match self.phase { // from CacheKey: set state to miss during cache lookup // from Bypass: response became cacheable, set state to miss to cache - CachePhase::CacheKey | CachePhase::Bypass => { + // from Stale: waited for cache lock, then retried and found asset was gone + CachePhase::CacheKey | CachePhase::Bypass | CachePhase::Stale => { self.phase = CachePhase::Miss; self.inner_mut().traces.start_miss_span(); } |