VladaZakharova commented on code in PR #56400:
URL: https://github.com/apache/airflow/pull/56400#discussion_r2405474088


##########
providers/google/src/airflow/providers/google/cloud/triggers/pubsub.py:
##########
@@ -86,26 +86,22 @@ def serialize(self) -> tuple[str, dict[str, Any]]:
         )
 
     async def run(self) -> AsyncIterator[TriggerEvent]:
-        try:
-            while True:
-                if pulled_messages := await self.hook.pull(
-                    project_id=self.project_id,
-                    subscription=self.subscription,
-                    max_messages=self.max_messages,
-                    return_immediately=True,
-                ):
-                    if self.ack_messages:
-                        await self.message_acknowledgement(pulled_messages)
+        while True:
+            if pulled_messages := await self.hook.pull(
+                project_id=self.project_id,
+                subscription=self.subscription,
+                max_messages=self.max_messages,
+                return_immediately=True,
+            ):
+                if self.ack_messages:
+                    await self.message_acknowledgement(pulled_messages)
 
-                    messages_json = [ReceivedMessage.to_dict(m) for m in 
pulled_messages]
+                messages_json = [ReceivedMessage.to_dict(m) for m in 
pulled_messages]
 
-                    yield TriggerEvent({"status": "success", "message": 
messages_json})
-                    return
-                self.log.info("Sleeping for %s seconds.", self.poke_interval)
-                await asyncio.sleep(self.poke_interval)
-        except Exception as e:
-            yield TriggerEvent({"status": "error", "message": str(e)})
-            return
+                yield TriggerEvent({"status": "success", "message": 
messages_json})
+                break

Review Comment:
   Actually this is not consistent according to implementation of 
   Triggers in Google provider. You have shared the examples of AWS provider, 
and right now it introduces inconsistency in the code now. 
   If it doesn't affect the behavior, there will be no problem to return back 
this line and not change the behavior here at all :)
   
   Can you please also provide screenshots of system tests executions?



-- 
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