aboutsummaryrefslogtreecommitdiffhomepage
path: root/pingora-proxy/src/proxy_cache.rs
diff options
context:
space:
mode:
Diffstat (limited to 'pingora-proxy/src/proxy_cache.rs')
-rw-r--r--pingora-proxy/src/proxy_cache.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/pingora-proxy/src/proxy_cache.rs b/pingora-proxy/src/proxy_cache.rs
index 4369ec8..8957bc7 100644
--- a/pingora-proxy/src/proxy_cache.rs
+++ b/pingora-proxy/src/proxy_cache.rs
@@ -667,8 +667,18 @@ impl<SV> HttpProxy<SV> {
None,
None,
);
- self.inner
+ if self
+ .inner
.should_serve_stale(session, ctx, Some(&http_status_error))
+ {
+ // no more need to keep the write lock
+ session
+ .cache
+ .release_write_lock(NoCacheReason::UpstreamError);
+ true
+ } else {
+ false
+ }
} else {
false // not 304, not stale if error status code
}
@@ -712,6 +722,11 @@ impl<SV> HttpProxy<SV> {
self.inner.request_summary(session, ctx)
);
+ // no more need to hang onto the cache lock
+ session
+ .cache
+ .release_write_lock(NoCacheReason::UpstreamError);
+
Some(self.proxy_cache_hit(session, ctx).await)
}