uranusjr commented on code in PR #28953:
URL: https://github.com/apache/airflow/pull/28953#discussion_r1070917542


##########
airflow/providers/telegram/hooks/telegram.py:
##########
@@ -137,5 +139,5 @@ def send_message(self, api_params: dict) -> None:
         if kwargs["chat_id"] is None:
             raise AirflowException("'chat_id' must be provided for telegram 
message")
 
-        response = self.connection.send_message(**kwargs)
+        response = 
asyncio.get_event_loop().run_until_complete(self.connection.send_message(**kwargs))

Review Comment:
   Let’s use `run` then, it has much better erro handling when something goes 
wrong.



##########
airflow/providers/telegram/hooks/telegram.py:
##########
@@ -137,5 +139,5 @@ def send_message(self, api_params: dict) -> None:
         if kwargs["chat_id"] is None:
             raise AirflowException("'chat_id' must be provided for telegram 
message")
 
-        response = self.connection.send_message(**kwargs)
+        response = 
asyncio.get_event_loop().run_until_complete(self.connection.send_message(**kwargs))

Review Comment:
   Let’s use `run` then, it has much better error handling (resource cleanup) 
when something goes wrong.



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