Bläddra i källkod

perf: Implemented short-circuit evaluation for logical conditions (#13674)

Co-authored-by: liusurong.lsr <liusurong.lsr@alibaba-inc.com>
tags/1.0.0
llinvokerl 8 månader sedan
förälder
incheckning
33a565a719
Inget konto är kopplat till bidragsgivarens mejladress
1 ändrade filer med 4 tillägg och 0 borttagningar
  1. 4
    0
      api/core/workflow/utils/condition/processor.py

+ 4
- 0
api/core/workflow/utils/condition/processor.py Visa fil

@@ -64,6 +64,10 @@ class ConditionProcessor:
expected=expected_value,
)
group_results.append(result)
# Implemented short-circuit evaluation for logical conditions
if (operator == "and" and not result) or (operator == "or" and result):
final_result = result
return input_conditions, group_results, final_result

final_result = all(group_results) if operator == "and" else any(group_results)
return input_conditions, group_results, final_result

Laddar…
Avbryt
Spara