baolsen commented on a change in pull request #16904:
URL: https://github.com/apache/airflow/pull/16904#discussion_r670256491
##########
File path: airflow/providers/amazon/aws/sensors/sqs.py
##########
@@ -69,31 +89,48 @@ def poke(self, context):
self.log.info('SQSSensor checking for message on queue: %s',
self.sqs_queue)
- messages = sqs_conn.receive_message(
- QueueUrl=self.sqs_queue,
- MaxNumberOfMessages=self.max_messages,
- WaitTimeSeconds=self.wait_time_seconds,
- )
+ receive_message_kwargs = {
+ 'QueueUrl': self.sqs_queue,
+ 'MaxNumberOfMessages': self.max_messages,
+ 'WaitTimeSeconds': self.wait_time_seconds,
+ }
+ if self.visibility_timeout is not None:
+ receive_message_kwargs['VisibilityTimeout'] =
self.visibility_timeout
+
+ response = sqs_conn.receive_message(**receive_message_kwargs)
+
+ if "Messages" not in response:
+ return False
- self.log.info("received message %s", str(messages))
+ messages = response['Messages']
+ num_messages = len(messages)
+ self.log.info("received %s messages", str(num_messages))
Review comment:
Thanks for the feedback, I didn't know about this. I'll get them all
fixed up
--
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]