mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 01:54:53 +00:00
Some improvements
This commit is contained in:
parent
efeac6b923
commit
df74cecdef
1 changed files with 2 additions and 3 deletions
|
|
@ -56,8 +56,8 @@ class RethinkDBStorage(BaseStorage):
|
||||||
"""
|
"""
|
||||||
Get or create connection.
|
Get or create connection.
|
||||||
"""
|
"""
|
||||||
if not self._connection:
|
async with self._lock: # thread-safe
|
||||||
async with self._lock: # thread-safe
|
if not self._connection:
|
||||||
self._connection = await r.connect(host=self._host, port=self._port, db=self._db, auth_key=self._auth_key, user=self._user,
|
self._connection = await r.connect(host=self._host, port=self._port, db=self._db, auth_key=self._auth_key, user=self._user,
|
||||||
password=self._password, timeout=self._timeout, ssl=self._ssl, io_loop=self._loop)
|
password=self._password, timeout=self._timeout, ssl=self._ssl, io_loop=self._loop)
|
||||||
return self._connection
|
return self._connection
|
||||||
|
|
@ -68,7 +68,6 @@ class RethinkDBStorage(BaseStorage):
|
||||||
"""
|
"""
|
||||||
if self._connection and self._connection.is_open():
|
if self._connection and self._connection.is_open():
|
||||||
await self._connection.close()
|
await self._connection.close()
|
||||||
del self._connection
|
|
||||||
self._connection = None
|
self._connection = None
|
||||||
|
|
||||||
def wait_closed(self):
|
def wait_closed(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue