aboutsummaryrefslogtreecommitdiffhomepage
path: root/pingora-proxy/src
diff options
context:
space:
mode:
authorEdward Wang <[email protected]>2024-08-02 16:41:20 -0700
committerAndrew Hauck <[email protected]>2024-08-09 14:30:49 -0700
commit7003ac34ad514edce4b9cda235ebdb498acd93f1 (patch)
treee194fff39a2b6fab7f584cd3daca3c249a2cae1e /pingora-proxy/src
parent35810d6c923eca12c516bc119e982737e30f824c (diff)
downloadpingora-7003ac34ad514edce4b9cda235ebdb498acd93f1.tar.gz
pingora-7003ac34ad514edce4b9cda235ebdb498acd93f1.zip
Set stale-updating as an explicit CachePhase
This cache phase indicates when we are serving a stale cache hit, but there is another request currently updating the asset.
Diffstat (limited to 'pingora-proxy/src')
-rw-r--r--pingora-proxy/src/proxy_cache.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/pingora-proxy/src/proxy_cache.rs b/pingora-proxy/src/proxy_cache.rs
index 5e90b18..77b7384 100644
--- a/pingora-proxy/src/proxy_cache.rs
+++ b/pingora-proxy/src/proxy_cache.rs
@@ -165,7 +165,9 @@ impl<SV> HttpProxy<SV> {
} else {
break None;
}
- } // else continue to serve stale
+ }
+ // else continue to serve stale
+ session.cache.set_stale_updating();
} else if session.cache.is_cache_lock_writer() {
// stale while revalidate logic for the writer
let will_serve_stale = session.cache.can_serve_stale_updating()
@@ -182,6 +184,7 @@ impl<SV> HttpProxy<SV> {
new_app.process_subrequest(subrequest, sub_req_ctx).await;
});
// continue to serve stale for this request
+ session.cache.set_stale_updating();
} else {
// return to fetch from upstream
break None;