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.
This commit is contained in:
Edward Wang 2024-07-31 17:08:48 -07:00 committed by Andrew Hauck
parent e0ade326ed
commit e5fda7c657
2 changed files with 3 additions and 2 deletions

2
.bleep
View file

@ -1 +1 @@
0f6ff9925981892f544498c8b322cc66f55281c8 e68f6024370efed50aebc8741171956acabf9c35

View file

@ -493,7 +493,8 @@ impl HttpCache {
match self.phase { match self.phase {
// from CacheKey: set state to miss during cache lookup // from CacheKey: set state to miss during cache lookup
// from Bypass: response became cacheable, set state to miss to cache // 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.phase = CachePhase::Miss;
self.inner_mut().traces.start_miss_span(); self.inner_mut().traces.start_miss_span();
} }