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.
This commit is contained in:
J. Nick Koston 2023-12-20 22:28:04 -10:00 committed by GitHub
parent 1d63c34816
commit 235914c63a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,7 +57,6 @@ from homeassistant.helpers.event import (
) )
from homeassistant.helpers.typing import ConfigType, EventType from homeassistant.helpers.typing import ConfigType, EventType
from homeassistant.loader import DHCPMatcher, async_get_dhcp from homeassistant.loader import DHCPMatcher, async_get_dhcp
from homeassistant.util.async_ import run_callback_threadsafe
from .const import DOMAIN from .const import DOMAIN
@ -145,13 +144,9 @@ class WatcherBase(ABC):
def process_client(self, ip_address: str, hostname: str, mac_address: str) -> None: def process_client(self, ip_address: str, hostname: str, mac_address: str) -> None:
"""Process a client.""" """Process a client."""
return run_callback_threadsafe( self.hass.loop.call_soon_threadsafe(
self.hass.loop, self.async_process_client, ip_address, hostname, mac_address
self.async_process_client, )
ip_address,
hostname,
mac_address,
).result()
@callback @callback
def async_process_client( def async_process_client(