Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion elastic_transport/_node/_http_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import os
import re
import ssl
import sys
import warnings
from typing import Optional, TypedDict, Union

Expand Down Expand Up @@ -65,6 +66,11 @@ class RequestKwarg(TypedDict, total=False):
_AIOHTTP_FIXED_HEAD_BUG = False


# Avoid aiohttp enabled_cleanup_closed warning: https://github.com/aio-libs/aiohttp/pull/9726
_NEEDS_CLEANUP_CLOSED_313 = (3, 13, 0) <= sys.version_info < (3, 13, 1)
_NEEDS_CLEANUP_CLOSED = _NEEDS_CLEANUP_CLOSED_313 or sys.version_info < (3, 12, 7)


class AiohttpHttpNode(BaseAsyncNode):
"""Default asynchronous node class using the ``aiohttp`` library via HTTP"""

Expand Down Expand Up @@ -262,7 +268,7 @@ def _create_aiohttp_session(self) -> None:
connector=aiohttp.TCPConnector(
limit_per_host=self._connections_per_node,
use_dns_cache=True,
enable_cleanup_closed=True,
enable_cleanup_closed=_NEEDS_CLEANUP_CLOSED,
ssl=self._ssl_context or False,
),
)
Expand Down
Loading