-
Notifications
You must be signed in to change notification settings - Fork 100
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
Draft: add psycopg3 pool #298
base: master
Are you sure you want to change the base?
Conversation
@@ -209,6 +209,6 @@ async def insert_records(event_for_wait: asyncio.Event) -> None: | |||
) | |||
|
|||
# The transaction has not been committed | |||
assert len(list(await TestModel.select().aio_execute())) == 0 | |||
assert len(list(await TestModel.select().aio_execute())) in (0, 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test about "insert all or nothing". Changed way of assert because pool in depth may handle disconnects/reconnects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea of the test is to make connection broken in the middle of transaction. In spite we close the pool psycopg3 somehow keep used connection alive. I tried to close the connection contained in AsyncConnectionPool._pool but it turned out to be a different connection than the one contained in connection_context.connection
…emove redundant imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a look at the PR. Looks great! I'm going to look into it in more detail a little later.
…here psycopg is not installed
peewee_async/pool.py
Outdated
if self.pool is None: | ||
await self.connect() | ||
assert self.pool is not None, "Pool is not connected" | ||
return await self.pool.getconn() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found some stats will not count since we use getconn instead of connection asynccontextmanager. https://github.com/psycopg/psycopg/blob/master/psycopg_pool/psycopg_pool/pool_async.py#L198
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created an issue #300 No need to fix in the PR
removed 3 postfix for psycopg
No description provided.