flows/executor: call plan.next before pop so we can save plan
ReevaluateMarker: use PolicyEngine without cache
This commit is contained in:
parent
6a4086c490
commit
dab53cfd03
|
@ -36,6 +36,7 @@ class ReevaluateMarker(StageMarker):
|
|||
def process(self, plan: "FlowPlan", stage: Stage) -> Optional[Stage]:
|
||||
"""Re-evaluate policies bound to stage, and if they fail, remove from plan"""
|
||||
engine = PolicyEngine(self.binding, self.user)
|
||||
engine.use_cache = False
|
||||
engine.request.context = plan.context
|
||||
engine.build()
|
||||
result = engine.result
|
||||
|
|
|
@ -138,6 +138,10 @@ class FlowExecutorView(View):
|
|||
stage_class=class_to_path(self.current_stage_view.__class__),
|
||||
flow_slug=self.flow.slug,
|
||||
)
|
||||
# We call plan.next here to check for re-evaluate markers
|
||||
# this is important so we can save the result
|
||||
# and we don't have to re-evaluate the policies each request
|
||||
self.plan.next()
|
||||
self.plan.pop()
|
||||
self.request.session[SESSION_KEY_PLAN] = self.plan
|
||||
if self.plan.stages:
|
||||
|
|
Reference in a new issue