Closed samtx closed 10 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
6588a97
) 93.73% compared to head (a95ee93
) 93.73%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks for the PR! Here's to hoping for more stability.
Description
This fixes a bug where asyncio tasks were created directly with the
asyncio.Task()
class instead of usingloop.create_task()
orasyncio.create_task()
. The Python documentation specifically says to [not create anasyncio.Task
directly](https://docs.python.org/3.8/library/asyncio-task.html#asyncio.Task:~:text=Use%20the%20high%2Dlevel%20asyncio.create_task()%20function%20to%20create%20Tasks%2C%20or%20the%20low%2Dlevel%20loop.create_task()%20or%20ensure_future()%20functions.%20Manual%20instantiation%20of%20Tasks%20is%20discouraged.). Creating the task directly could lead to issues when using alternate event loops like uvloop. The Python abstract event loop has a dedicatedloop.set_task_factory
method for overriding the function to create theasyncio.Task
. An application using a custom asyncio task factory could experience weird, unknown behavior, especially if the agents raise an exception or hang due to blocking code.