From 235914c63ac584022da8f8caf73e8064e536466c Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" <nick@koston.org> Date: Wed, 20 Dec 2023 22:28:04 -1000 Subject: [PATCH] Improve performance of dhcp integration client processing (#106137) We were using run_callback_threadsafe here which has the overhead of creating a future and waiting for the result when we throw it away. --- homeassistant/components/dhcp/__init__.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/dhcp/__init__.py b/homeassistant/components/dhcp/__init__.py index df95e629b8f..2afe53422fb 100644 --- a/homeassistant/components/dhcp/__init__.py +++ b/homeassistant/components/dhcp/__init__.py @@ -57,7 +57,6 @@ from homeassistant.helpers.event import ( ) from homeassistant.helpers.typing import ConfigType, EventType from homeassistant.loader import DHCPMatcher, async_get_dhcp -from homeassistant.util.async_ import run_callback_threadsafe from .const import DOMAIN @@ -145,13 +144,9 @@ class WatcherBase(ABC): def process_client(self, ip_address: str, hostname: str, mac_address: str) -> None: """Process a client.""" - return run_callback_threadsafe( - self.hass.loop, - self.async_process_client, - ip_address, - hostname, - mac_address, - ).result() + self.hass.loop.call_soon_threadsafe( + self.async_process_client, ip_address, hostname, mac_address + ) @callback def async_process_client( -- GitLab