diff --git a/elasticsearch_async/connection.py b/elasticsearch_async/connection.py index 7e41665..96e3cf5 100644 --- a/elasticsearch_async/connection.py +++ b/elasticsearch_async/connection.py @@ -2,6 +2,7 @@ import aiohttp from aiohttp.client_exceptions import ServerFingerprintMismatch +import async_timeout from elasticsearch.exceptions import ConnectionError, ConnectionTimeout, SSLError from elasticsearch.connection import Connection @@ -90,7 +91,7 @@ def perform_request(self, method, url, params=None, body=None, timeout=None, ign start = self.loop.time() response = None try: - with aiohttp.Timeout(timeout or self.timeout, loop=self.loop): + with async_timeout.timeout(timeout or self.timeout, loop=self.loop): response = yield from self.session.request(method, url, data=body, headers=headers) raw_data = yield from response.text() duration = self.loop.time() - start diff --git a/setup.py b/setup.py index 459e4c7..2ffac19 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,7 @@ install_requires = [ 'aiohttp', + 'async_timeout', 'elasticsearch>=6.0.0', ]