From 3f5b7d16205c0c18ae1799e5a58a92e071e1a52b Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman <the@jeffreyfreeman.me> Date: Sat, 26 Mar 2022 22:11:48 +0300 Subject: [PATCH] Fixed a few more loop bugs related to 3.10. --- aiogremlin/driver/cluster.py | 2 +- aiogremlin/driver/connection.py | 3 +-- aiogremlin/driver/pool.py | 2 +- aiogremlin/driver/resultset.py | 7 +++---- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/aiogremlin/driver/cluster.py b/aiogremlin/driver/cluster.py index 9895cda..98c4a3b 100644 --- a/aiogremlin/driver/cluster.py +++ b/aiogremlin/driver/cluster.py @@ -220,5 +220,5 @@ class Cluster: while self._hosts: host = self._hosts.popleft() waiters.append(host.close()) - await asyncio.gather(*waiters, loop=self._loop) + await asyncio.gather(*waiters) self._closed = True diff --git a/aiogremlin/driver/connection.py b/aiogremlin/driver/connection.py index cc018a6..ebb21b7 100644 --- a/aiogremlin/driver/connection.py +++ b/aiogremlin/driver/connection.py @@ -46,8 +46,7 @@ class Connection: self._closed = False self._result_sets = {} self._receive_task = self._loop.create_task(self._receive()) - self._semaphore = asyncio.Semaphore(value=max_inflight, - loop=self._loop) + self._semaphore = asyncio.Semaphore(value=max_inflight) if isinstance(message_serializer, type): message_serializer = message_serializer() self._message_serializer = message_serializer diff --git a/aiogremlin/driver/pool.py b/aiogremlin/driver/pool.py index a4070ad..c87715c 100644 --- a/aiogremlin/driver/pool.py +++ b/aiogremlin/driver/pool.py @@ -189,7 +189,7 @@ class ConnectionPool: while self._acquired: conn = self._acquired.popleft() waiters.append(conn.close()) - await asyncio.gather(*waiters, loop=self._loop) + await asyncio.gather(*waiters) async def _get_connection(self, username, password, max_inflight, response_timeout, message_serializer, provider): diff --git a/aiogremlin/driver/resultset.py b/aiogremlin/driver/resultset.py index c0a3d64..a367333 100644 --- a/aiogremlin/driver/resultset.py +++ b/aiogremlin/driver/resultset.py @@ -22,11 +22,11 @@ def error_handler(fn): class ResultSet: """Gremlin Server response implementated as an async iterator.""" def __init__(self, request_id, timeout, loop): - self._response_queue = asyncio.Queue(loop=loop) + self._response_queue = asyncio.Queue() self._request_id = request_id self._loop = loop self._timeout = timeout - self._done = asyncio.Event(loop=self._loop) + self._done = asyncio.Event() self._aggregate_to = None @property @@ -82,8 +82,7 @@ class ResultSet: else: try: msg = await asyncio.wait_for(self._response_queue.get(), - timeout=self._timeout, - loop=self._loop) + timeout=self._timeout) except asyncio.TimeoutError: self.close() raise exception.ResponseTimeoutError('Response timed out') -- GitLab