diff --git a/asynch/connection.py b/asynch/connection.py index cc60830..38c9c09 100644 --- a/asynch/connection.py +++ b/asynch/connection.py @@ -33,7 +33,6 @@ def __init__( self._is_closed = False self._echo = echo self._cursor_cls = cursor_cls - self._connected = False if dsn: self._connection = ProtoConnection( **self._parse_dsn(dsn), stack_track=stack_track, **kwargs @@ -54,7 +53,7 @@ def __repr__(self): @property def connected(self): - return self._connected + return self._connection.connected @property def host(self): @@ -93,10 +92,9 @@ async def rollback(self): raise errors.NotSupportedError async def connect(self): - if self._connected: + if self.connected: return await self._connection.connect() - self._connected = True def cursor(self, cursor: Type[Cursor] = None) -> Cursor: cursor_cls = cursor or self._cursor_cls diff --git a/asynch/pool.py b/asynch/pool.py index 873fec1..6c574c9 100644 --- a/asynch/pool.py +++ b/asynch/pool.py @@ -145,7 +145,7 @@ async def release(self, connection: Connection): await connection.close() else: self._free.append(connection) - fut = self._loop.create_task(self._wakeup()) + fut = self._loop.create_task(self._wakeup()) return fut async def _wakeup(self):