aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.bleep2
-rw-r--r--pingora-proxy/src/proxy_cache.rs18
2 files changed, 18 insertions, 2 deletions
diff --git a/.bleep b/.bleep
index 0c316c3..6c2c495 100644
--- a/.bleep
+++ b/.bleep
@@ -1 +1 @@
-a4032182c556d6fee5f22d0b56b99b03c8fc6868 \ No newline at end of file
+c9b2323f5cb8843bd0c24c82df577cd7a419ff6d \ No newline at end of file
diff --git a/pingora-proxy/src/proxy_cache.rs b/pingora-proxy/src/proxy_cache.rs
index 77b7384..e9914cf 100644
--- a/pingora-proxy/src/proxy_cache.rs
+++ b/pingora-proxy/src/proxy_cache.rs
@@ -309,7 +309,23 @@ impl<SV> HttpProxy<SV> {
}
loop {
match session.cache.hit_handler().read_body().await {
- Ok(body) => {
+ Ok(mut body) => {
+ let end = body.is_none();
+ match self
+ .inner
+ .response_body_filter(session, &mut body, end, ctx)
+ {
+ Ok(Some(duration)) => {
+ trace!("delaying response for {duration:?}");
+ time::sleep(duration).await;
+ }
+ Ok(None) => { /* continue */ }
+ Err(e) => {
+ // body is being sent, don't treat downstream as reusable
+ return (false, Some(e));
+ }
+ }
+
if let Some(b) = body {
// write to downstream
if let Err(e) = session