syedahsn commented on code in PR #32809:
URL: https://github.com/apache/airflow/pull/32809#discussion_r1279960782


##########
airflow/providers/amazon/aws/sensors/sqs.py:
##########
@@ -131,19 +165,7 @@ def poll_sqs(self, sqs_conn: BaseAwsConnection) -> 
Collection:
             receive_message_kwargs["VisibilityTimeout"] = 
self.visibility_timeout
 
         response = sqs_conn.receive_message(**receive_message_kwargs)
-
-        if "Messages" not in response:
-            return []
-
-        messages = response["Messages"]
-        num_messages = len(messages)
-        self.log.info("Received %d messages", num_messages)
-
-        if num_messages and self.message_filtering:
-            messages = self.filter_messages(messages)
-            num_messages = len(messages)
-            self.log.info("There are %d messages left after filtering", 
num_messages)
-        return messages
+        return response

Review Comment:
   No it doesn't change the behavior because the original returned value, 
`messages`, is still being used in the `poke` method. All I'm doing is pulling 
out the logic of parsing the response (from lines 135 to 146 in the original 
code) to a separate function so it can be reused in the Trigger. The method 
`process_response` takes the response from `poll_sqs` and returns `messages`, 
which then gets used, just like it was before.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to