aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEdward Wang <[email protected]>2024-07-31 17:08:48 -0700
committerEdward Wang <[email protected]>2024-07-31 17:08:51 -0700
commitc84a43c815cd2ea56fab6d37b1a7f3aac1e70c7d (patch)
tree9dd099a643d2fa9f286327d65707ebd454a6cfe5
parenta48fe3c58a674dbcf9bd8a53006a4ec6b2ea1200 (diff)
downloadpingora-c84a43c815cd2ea56fab6d37b1a7f3aac1e70c7d.tar.gz
pingora-c84a43c815cd2ea56fab6d37b1a7f3aac1e70c7d.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--.bleep2
-rw-r--r--pingora-cache/src/lib.rs3
2 files changed, 3 insertions, 2 deletions
diff --git a/.bleep b/.bleep
index 5b7d250..9ab32a4 100644
--- a/.bleep
+++ b/.bleep
@@ -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();
}