mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
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:
parent
1d63c34816
commit
235914c63a
@ -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(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user