Skip to content

Conversation

@josh-janes
Copy link
Contributor

This PR resolves startup errors and makes shutting down the API with Ctrl+C more graceful

Context:

While starting the API I was getting unhandled exceptions:
RuntimeError: Task <Task pending name='Task-1487' coro=<ClientCreatorContext.__aexit__()>> got Future <Task pending name='Task-1497' coro=<_wait_for_close()>> attached to a different loop

The issue here seems to be in how we handle the async lifespan, specifically it seems like there are situations where tasks do not get shut down properly.

The change here is simple, basically it makes sure that these processes don't get orphaned with a finally clause.

Let me know if there are already methods equivalent to _cancel_task/_cancel_tasks.

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

3 participants