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 | |
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.
-rw-r--r-- | .bleep | 2 | ||||
-rw-r--r-- | pingora-cache/src/lib.rs | 3 |
2 files changed, 3 insertions, 2 deletions
@@ -1 +1 @@ -0f6ff9925981892f544498c8b322cc66f55281c8
\ No newline at end of file +e68f6024370efed50aebc8741171956acabf9c35
\ No newline at end of file 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(); } |