From 7003ac34ad514edce4b9cda235ebdb498acd93f1 Mon Sep 17 00:00:00 2001 From: Edward Wang Date: Fri, 2 Aug 2024 16:41:20 -0700 Subject: 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. --- pingora-proxy/src/proxy_cache.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pingora-proxy/src') 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 HttpProxy { } 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 HttpProxy { 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; -- cgit v1.2.3