Skip to content

Commit

Permalink
Merge pull request #98 from vizor-games/feature/#71-Correct_check_lif…
Browse files Browse the repository at this point in the history
…e_connection

#71 Correct check life connection
  • Loading branch information
long2ice authored Apr 22, 2024
2 parents 12e00b1 + d8090f4 commit 5f5b859
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions asynch/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -54,7 +53,7 @@ def __repr__(self):

@property
def connected(self):
return self._connected
return self._connection.connected

@property
def host(self):
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion asynch/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 5f5b859

Please # to comment.