Small speed up to data entry flow steps (#105713)
Instead of checking if the flow is completed with a linear tuple search each time, use a constant set
This commit is contained in:
parent
ffb963c4c5
commit
0d9a583f4d
1 changed files with 10 additions and 8 deletions
|
@ -46,6 +46,15 @@ RESULT_TYPE_MENU = "menu"
|
|||
# Event that is fired when a flow is progressed via external or progress source.
|
||||
EVENT_DATA_ENTRY_FLOW_PROGRESSED = "data_entry_flow_progressed"
|
||||
|
||||
FLOW_NOT_COMPLETE_STEPS = {
|
||||
FlowResultType.FORM,
|
||||
FlowResultType.EXTERNAL_STEP,
|
||||
FlowResultType.EXTERNAL_STEP_DONE,
|
||||
FlowResultType.SHOW_PROGRESS,
|
||||
FlowResultType.SHOW_PROGRESS_DONE,
|
||||
FlowResultType.MENU,
|
||||
}
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class BaseServiceInfo:
|
||||
|
@ -407,14 +416,7 @@ class FlowManager(abc.ABC):
|
|||
error_if_core=False,
|
||||
)
|
||||
|
||||
if result["type"] in (
|
||||
FlowResultType.FORM,
|
||||
FlowResultType.EXTERNAL_STEP,
|
||||
FlowResultType.EXTERNAL_STEP_DONE,
|
||||
FlowResultType.SHOW_PROGRESS,
|
||||
FlowResultType.SHOW_PROGRESS_DONE,
|
||||
FlowResultType.MENU,
|
||||
):
|
||||
if result["type"] in FLOW_NOT_COMPLETE_STEPS:
|
||||
self._raise_if_step_does_not_exist(flow, result["step_id"])
|
||||
flow.cur_step = result
|
||||
return result
|
||||
|
|
Loading…
Add table
Reference in a new issue