Skip to content

Commit 6ad583b

Browse files
Addressing Mathieu's feedback
1 parent 66642a6 commit 6ad583b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

aws_lambda_powertools/utilities/batch/sqs_fifo_partial_processor.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ def __init__(self, model: Optional["BatchSqsTypeModel"] = None, skip_group_on_er
6969
model: Optional["BatchSqsTypeModel"]
7070
An optional model for batch processing.
7171
skip_group_on_error: bool
72-
# TODO: Alterar
73-
Determine whether to return on the first error encountered. Default is True
72+
Determines whether to exclusively skip messages from the MessageGroupID that encountered processing failures
73+
Default is False
7474
7575
"""
7676
self._skip_group_on_error = skip_group_on_error
@@ -82,7 +82,7 @@ def process(self) -> List[Tuple]:
8282
the process is short-circuited, and the remaining messages are reported as failed items.
8383
"""
8484
result: List[Tuple] = []
85-
skip_messages_group_id: List = []
85+
skip_message_ids: List = []
8686

8787
for i, record in enumerate(self.records):
8888
# If we have failed messages and we are set to return on the first error,
@@ -95,21 +95,21 @@ def process(self) -> List[Tuple]:
9595

9696
# skip_group_on_error is True:
9797
# Skip processing the current message if its ID belongs to a group with failed messages
98-
if msg_id in skip_messages_group_id:
98+
if msg_id in skip_message_ids:
9999
logger.debug(
100100
f"Skipping message with ID '{msg_id}' as it is part of a group containing failed messages.",
101101
)
102102
continue
103103

104-
processed_messages = self._process_record(record)
104+
processed_message = self._process_record(record)
105105

106106
# If a processed message fail and skip_group_on_error is True,
107107
# mark subsequent messages from the same MessageGroupId as skipped
108-
if processed_messages[0] == "fail" and self._skip_group_on_error:
109-
self._process_failed_subsequent_messages(record, i, skip_messages_group_id, result)
108+
if processed_message[0] == "fail" and self._skip_group_on_error:
109+
self._process_failed_subsequent_messages(record, i, skip_message_ids, result)
110110

111111
# Append the processed message normally
112-
result.append(processed_messages)
112+
result.append(processed_message)
113113

114114
return result
115115

0 commit comments

Comments
 (0)