mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Avoid creating another ssl context in cert_expiry (#113467)
Creating an ssl context does blocking I/O as it has to read the certs from disk
This commit is contained in:
parent
5b80eb4c3d
commit
4fb127e5af
@ -2,13 +2,13 @@
|
||||
|
||||
import asyncio
|
||||
import datetime
|
||||
from functools import cache
|
||||
import socket
|
||||
import ssl
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.util import dt as dt_util
|
||||
from homeassistant.util.ssl import get_default_context
|
||||
|
||||
from .const import TIMEOUT
|
||||
from .errors import (
|
||||
@ -19,12 +19,6 @@ from .errors import (
|
||||
)
|
||||
|
||||
|
||||
@cache
|
||||
def _get_default_ssl_context() -> ssl.SSLContext:
|
||||
"""Return the default SSL context."""
|
||||
return ssl.create_default_context()
|
||||
|
||||
|
||||
async def async_get_cert(
|
||||
hass: HomeAssistant,
|
||||
host: str,
|
||||
@ -36,7 +30,7 @@ async def async_get_cert(
|
||||
asyncio.Protocol,
|
||||
host,
|
||||
port,
|
||||
ssl=_get_default_ssl_context(),
|
||||
ssl=get_default_context(),
|
||||
happy_eyeballs_delay=0.25,
|
||||
server_hostname=host,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user