66from typing import TYPE_CHECKING
77if TYPE_CHECKING :
88 from asyncio .windows_events import ProactorEventLoop
9+ from .pools import AsyncPoolWrapper
910
1011class AsyncConnectionWrapper_context (BaseManager ):
1112
@@ -19,12 +20,14 @@ async def __aexit__(self, exc_type, exc, tb):
1920
2021class AsyncConnectionWrapper :
2122
22- def __init__ (self , conn : Connection , loop : 'ProactorEventLoop' , thread_pool : ThreadPoolExecutor , pool : SessionPool ):
23+ def __init__ (self , conn : Connection , loop : 'ProactorEventLoop' , thread_pool : ThreadPoolExecutor , pool : SessionPool , pool_wrapper : 'AsyncPoolWrapper' ):
2324 self ._conn = conn
2425 self ._loop = loop
2526 self ._pool = pool
27+ self ._pool_wrapper = pool_wrapper
2628 self ._thread_pool = thread_pool
2729
30+
2831 def cursor (self ):
2932 coro = self ._loop .run_in_executor (self ._thread_pool , self ._cursor )
3033 return AsyncCursorWrapper_context (coro )
@@ -39,6 +42,42 @@ def msgproperties(self , *args , **kwargs):
3942 def encoding (self ):
4043 return self ._conn .encoding
4144
45+ @property
46+ def dsn (self ):
47+ return self ._conn .dsn
48+
49+ @property
50+ def module (self ):
51+ return self ._conn .module
52+
53+ @module .setter
54+ def module (self , arg ):
55+ self ._conn .module = arg
56+
57+ @property
58+ def action (self ):
59+ return self ._conn .action
60+
61+ @action .setter
62+ def action (self , arg ):
63+ self ._conn .action = arg
64+
65+ @property
66+ def client_identifier (self ):
67+ return self ._conn .client_identifier
68+
69+ @client_identifier .setter
70+ def client_identifier (self , arg ):
71+ self ._conn .client_identifier = arg
72+
73+ @property
74+ def clientinfo (self ):
75+ return self ._conn .clientinfo
76+
77+ @clientinfo .setter
78+ def clientinfo (self , arg ):
79+ self ._conn .clientinfo = arg
80+
4281 async def queue (self , * args , ** kwargs ):
4382 return AsyncQueueWrapper (self ._conn .queue (* args , ** kwargs ) , self ._loop , self ._thread_pool , self )
4483
@@ -49,7 +88,17 @@ async def gettype(self , *args , **kwargs):
4988 return await self ._loop .run_in_executor (self ._thread_pool , self ._conn .gettype , * args , ** kwargs )
5089
5190 async def commit (self ):
52- await self ._loop .run_in_executor (self ._thread_pool , self ._conn .commit )
91+ return await self ._loop .run_in_executor (self ._thread_pool , self ._conn .commit )
5392
5493 async def release (self ):
55- return await self ._loop .run_in_executor (self ._thread_pool , self ._pool .release , self ._conn )
94+ self ._pool_wrapper ._unoccupied (self ._conn )
95+ return await self ._loop .run_in_executor (self ._thread_pool , self ._pool .release , self ._conn )
96+
97+ async def cancel (self ):
98+ return await self ._loop .run_in_executor (self ._thread_pool , self ._conn .cancel )
99+
100+ async def ping (self ):
101+ return await self ._loop .run_in_executor (self ._thread_pool , self ._conn .ping )
102+
103+ async def rollback (self ):
104+ return await self ._loop .run_in_executor (self ._thread_pool , self ._conn .rollback )
0 commit comments