Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/application/workflow/nodes/loop_node/loop_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ def execute(self):
if loop_type == "ARRAY":
iterator = _generate_loop_array(array, start_index=start_index)
elif loop_type == "LOOP":
iterator = _generate_while_loop(number or MAX_LOOP_COUNT, start_index=start_index)
# 无限循环以 MAX_LOOP_COUNT 作为上限
iterator = _generate_while_loop(MAX_LOOP_COUNT, start_index=start_index)
else:
iterator = _generate_loop_number(number, start_index=start_index)
self._workflow_params = workflow_params

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change removes the use of number entirely in the LOOP branch, always using MAX_LOOP_COUNT.

Potential issues:

  • Behavior change: If number was meant to control the loop count, it’s now ignored. The previous number or MAX_LOOP_COUNT would use number when truthy, falling back to MAX_LOOP_COUNT otherwise.
  • Comment mismatch: The comment says “infinite loop” (无限循环) but uses a finite MAX_LOOP_COUNT, so it’s not truly infinite.
  • Unused variable: In this branch, number becomes unused, which may indicate a bug or leftover logic.

Optimization / suggestion:

If the intent is truly an infinite loop with a safety cap, keep MAX_LOOP_COUNT but update the comment to reflect that. If number should still matter, revert to something like:

iterator = _generate_while_loop(number or MAX_LOOP_COUNT, start_index=start_index)

or clarify the purpose explicitly:

# Use MAX_LOOP_COUNT as a hard upper bound for safety
iterator = _generate_while_loop(MAX_LOOP_COUNT, start_index=start_index)

Expand Down
Loading