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

fix(sqla_factory): added an async context manager in SQLAASyncPersistence #630

Merged
merged 2 commits into from
Jan 15, 2025

Conversation

nisemenov
Copy link
Contributor

Description

  • an async context manager has been added in SQLAASyncPersistence class to prevent
...
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

The garbage collector is trying to clean up non-checked-in connection <AdaptedConnection <asyncpg.connection.Connection
object>>, which will be terminated.  Please ensure that SQLAlchemy pooled connections are returned to the pool 
explicitly, either by calling ``close()`` or by using appropriate context managers to manage their lifecycle.

sys:1: SAWarning: The garbage collector is trying to clean up non-checked-in connection <AdaptedConnection 
<asyncpg.connection.Connection object>>, which will be terminated.  Please ensure that SQLAlchemy pooled connections are 
returned to the pool explicitly, either by calling ``close()`` or by using appropriate context managers to manage 
their lifecycle.

Closes

@nisemenov nisemenov requested a review from guacs as a code owner January 15, 2025 12:56
@adhtruong adhtruong force-pushed the pr_async_context_manager branch from 729d838 to ff81dc1 Compare January 15, 2025 20:27
@adhtruong adhtruong enabled auto-merge (squash) January 15, 2025 20:27
@adhtruong adhtruong merged commit 137bfb9 into litestar-org:main Jan 15, 2025
25 checks passed
Copy link

Documentation preview will be available shortly at https://litestar-org.github.io/polyfactory-docs-preview/630

@nisemenov nisemenov deleted the pr_async_context_manager branch January 16, 2025 07:18
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.

2 participants