tirkarthi commented on code in PR #64869:
URL: https://github.com/apache/airflow/pull/64869#discussion_r3168146275


##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -911,13 +911,22 @@ async def _aget_response(self, expect_id: int) -> 
ToTriggerRunner | None:
         return self._from_frame(frame)
 
     async def asend(self, msg: ToTriggerSupervisor) -> ToTriggerRunner | None:
-        frame = _RequestFrame(id=next(self.id_counter), body=msg.model_dump())
-        bytes = frame.as_bytes()
+        loop = asyncio.get_running_loop()
+        await loop.run_in_executor(None, self._thread_lock.acquire)

Review Comment:
   `asyncio.to_thread` is available from Python 3.9 and does similar thing.
   
   https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
   
   
https://github.com/python/cpython/blob/4599335a83a22cf73a0c20e3692c29fd0278d23b/Lib/asyncio/threads.py#L12-L25



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