From ecd4d5e013077d0f9600c7e9102649b59c438753 Mon Sep 17 00:00:00 2001 From: Seth Michael Larson Date: Thu, 10 Feb 2022 21:13:41 -0600 Subject: [PATCH] Set enable_cleanup_closed=True --- elasticsearch/_async/http_aiohttp.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/elasticsearch/_async/http_aiohttp.py b/elasticsearch/_async/http_aiohttp.py index f4bbc779b..9120c8638 100644 --- a/elasticsearch/_async/http_aiohttp.py +++ b/elasticsearch/_async/http_aiohttp.py @@ -378,13 +378,16 @@ async def _create_aiohttp_session(self): self.loop = get_running_loop() self.session = aiohttp.ClientSession( headers=self.headers, - skip_auto_headers=("accept", "accept-encoding"), + skip_auto_headers=("accept", "accept-encoding", "user-agent"), auto_decompress=True, loop=self.loop, cookie_jar=aiohttp.DummyCookieJar(), response_class=ESClientResponse, connector=aiohttp.TCPConnector( - limit=self._limit, use_dns_cache=True, ssl=self._ssl_context + limit=self._limit, + use_dns_cache=True, + enable_cleanup_closed=True, + ssl=self._ssl_context, ), )