Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit b7d307e

Browse files
ciscornfxdgear
authored andcommitted
CancelledError shouldn't be logged as request failure (#45)
1 parent 98e8d10 commit b7d307e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

elasticsearch_async/connection.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ def perform_request(self, method, url, params=None, body=None, timeout=None, ign
9999
raw_data = yield from response.text()
100100
duration = self.loop.time() - start
101101

102+
except asyncio.CancelledError:
103+
raise
104+
102105
except Exception as e:
103106
self.log_request_fail(method, url, url_path, body, self.loop.time() - start, exception=e)
104107
if isinstance(e, ServerFingerprintMismatch):

elasticsearch_async/connection_pool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ def __init__(self, connections, loop, **kwargs):
99
super().__init__(connections, **kwargs)
1010

1111
async def close(self):
12-
await asyncio.gather(*[conn.close() for conn in self.orig_connections],
13-
loop=self.loop)
12+
await asyncio.wait([conn.close() for conn in self.orig_connections],
13+
loop=self.loop)
1414

1515

1616
class AsyncDummyConnectionPool(DummyConnectionPool):

0 commit comments

Comments
 (0)