Skip to content

Commit

Permalink
Allow Stale phase in cache_miss
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
drcaramelsyrup authored and andrewhavck committed Aug 9, 2024
1 parent e0ade32 commit e5fda7c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .bleep
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0f6ff9925981892f544498c8b322cc66f55281c8
e68f6024370efed50aebc8741171956acabf9c35
3 changes: 2 additions & 1 deletion pingora-cache/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit e5fda7c

Please sign in to comment.