mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
parent
877efc993b
commit
0575b9bc88
@ -39,6 +39,20 @@ SERVER_SOFTWARE = "{0}/{1} aiohttp/{2} Python/{3[0]}.{3[1]}".format(
|
|||||||
|
|
||||||
WARN_CLOSE_MSG = "closes the Home Assistant aiohttp session"
|
WARN_CLOSE_MSG = "closes the Home Assistant aiohttp session"
|
||||||
|
|
||||||
|
#
|
||||||
|
# The default connection limit of 100 meant that you could only have
|
||||||
|
# 100 concurrent connections.
|
||||||
|
#
|
||||||
|
# This was effectively a limit of 100 devices and than
|
||||||
|
# the supervisor API would fail as soon as it was hit.
|
||||||
|
#
|
||||||
|
# We now apply the 100 limit per host, so that we can have 100 connections
|
||||||
|
# to a single host, but can have more than 4096 connections in total to
|
||||||
|
# prevent a single host from using all available connections.
|
||||||
|
#
|
||||||
|
MAXIMUM_CONNECTIONS = 4096
|
||||||
|
MAXIMUM_CONNECTIONS_PER_HOST = 100
|
||||||
|
|
||||||
|
|
||||||
class HassClientResponse(aiohttp.ClientResponse):
|
class HassClientResponse(aiohttp.ClientResponse):
|
||||||
"""aiohttp.ClientResponse with a json method that uses json_loads by default."""
|
"""aiohttp.ClientResponse with a json method that uses json_loads by default."""
|
||||||
@ -261,7 +275,12 @@ def _async_get_connector(
|
|||||||
else:
|
else:
|
||||||
ssl_context = False
|
ssl_context = False
|
||||||
|
|
||||||
connector = aiohttp.TCPConnector(enable_cleanup_closed=True, ssl=ssl_context)
|
connector = aiohttp.TCPConnector(
|
||||||
|
enable_cleanup_closed=True,
|
||||||
|
ssl=ssl_context,
|
||||||
|
limit=MAXIMUM_CONNECTIONS,
|
||||||
|
limit_per_host=MAXIMUM_CONNECTIONS_PER_HOST,
|
||||||
|
)
|
||||||
hass.data[key] = connector
|
hass.data[key] = connector
|
||||||
|
|
||||||
async def _async_close_connector(event: Event) -> None:
|
async def _async_close_connector(event: Event) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user