Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use loop.create_task() for agent tasks #598

Merged
merged 9 commits into from
Jan 3, 2024

Conversation

samtx
Copy link
Collaborator

@samtx samtx commented Jan 3, 2024

Description

This fixes a bug where asyncio tasks were created directly with the asyncio.Task() class instead of using loop.create_task() or asyncio.create_task(). The Python documentation specifically says to not create an asyncio.Task directly. Creating the task directly could lead to issues when using alternate event loops like uvloop. The Python abstract event loop has a dedicated loop.set_task_factory method for overriding the function to create the asyncio.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.

@wbarnha wbarnha marked this pull request as ready for review January 3, 2024 15:52
@wbarnha wbarnha self-assigned this Jan 3, 2024
@wbarnha wbarnha self-requested a review January 3, 2024 15:52
Copy link

codecov bot commented Jan 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6588a97) 93.73% compared to head (a95ee93) 93.73%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #598   +/-   ##
=======================================
  Coverage   93.73%   93.73%           
=======================================
  Files         102      102           
  Lines       11158    11158           
  Branches     1536     1536           
=======================================
  Hits        10459    10459           
  Misses        612      612           
  Partials       87       87           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wbarnha
Copy link
Member

wbarnha commented Jan 3, 2024

Thanks for the PR! Here's to hoping for more stability.

@wbarnha wbarnha merged commit 1f1f759 into faust-streaming:master Jan 3, 2024
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants