fix: Infinite loop increases maximum loop count limit#4089
Conversation
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| max_loop_count = int((CONFIG.get("MAX_LOOP_COUNT") or 1000)) | ||
|
|
||
|
|
||
| def _is_interrupt_exec(node, node_variable: Dict, workflow_variable: Dict): |
There was a problem hiding this comment.
Your function _is_interrupt_exec has a few minor improvements:
-
Consistent Type Hinting: You added
from collections import Dict, but since Python supports type hints natively with dictionaries likeDict[key_type, value_type], you can remove this line. -
Conversion to Integer: The conversion of
CONFIG.get("MAX_LOOP_COUNT")to an integer is already done using(int()). This seems redundant and can be removed if the default value (1000) is also converted to an integer implicitly in Python.
Here's the revised code:
from maxkb.const import CONFIG
from django.utils.translation import gettext as _
max_loop_count = int(CONFIG.get("MAX_LOOP_COUNT", 1000))
def _is_interrupt_exec(node, node_variable: dict, workflow_variable: dict):These changes improve readability slightly without introducing unnecessary complexity.
fix: Infinite loop increases maximum loop count limit