Skip to content

Commit 31e75f2

Browse files
committed
fix(fsm): set Forward(Bypass) in SelectiveCacheFuture passthrough path
1 parent 7345e58 commit 31e75f2

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

hitbox/src/fsm/selective/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::backend::CacheBackend;
2121
use crate::concurrency::ConcurrencyManager;
2222
use crate::fsm::CacheFuture;
2323
use crate::policy::PolicyConfig;
24-
use crate::{CacheConfig, CacheContext, CacheableRequest, CacheableResponse};
24+
use crate::{CacheConfig, CacheContext, CacheStatus, CacheableRequest, CacheableResponse};
2525

2626
use states::{CheckPredicate, Passthrough, SelectiveState, SelectiveStateProj};
2727

@@ -249,8 +249,9 @@ where
249249
let passthrough = state.as_ref().expect(POLL_AFTER_READY);
250250
trace!(parent: &passthrough.span, "FSM state: Passthrough");
251251
let response = ready!(upstream_future.poll(cx));
252-
let ctx = CacheContext::default().boxed();
253-
let ctx = hitbox_core::finalize_context(ctx);
252+
let mut ctx = CacheContext::default();
253+
ctx.status = CacheStatus::Forward(hitbox_core::ForwardReason::Bypass);
254+
let ctx = hitbox_core::finalize_context(ctx.boxed());
254255
return Poll::Ready((response, ctx));
255256
}
256257
};

hitbox/src/fsm/states.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ where
244244
/// Based on policy configuration:
245245
/// - Enabled: create CheckRequestCachePolicy future
246246
/// - Disabled: call upstream directly
247-
pub fn transition<'req>(self, policy: &PolicyConfig) -> InitialTransition<'req, Req, U>
247+
pub fn transition<'req>(mut self, policy: &PolicyConfig) -> InitialTransition<'req, Req, U>
248248
where
249249
Req: 'req,
250250
ReqP: 'req,

0 commit comments

Comments
 (0)