Remove unneeded usage of run_callback_threadsafe in entity helper (#106138)

We do not need to create a future here as we do not
need to wait for the result as its going to run
in the background in a task anyways
pull/106146/head
J. Nick Koston 2023-12-20 12:57:20 -10:00 committed by GitHub
parent 24b1e01d71
commit dfb08e7efd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -31,7 +31,6 @@ from homeassistant.core import (
from homeassistant.exceptions import HomeAssistantError, PlatformNotReady
from homeassistant.generated import languages
from homeassistant.setup import async_start_setup
from homeassistant.util.async_ import run_callback_threadsafe
from . import (
config_validation as cv,
@ -429,12 +428,11 @@ class EntityPlatform:
self, new_entities: Iterable[Entity], update_before_add: bool = False
) -> None:
"""Schedule adding entities for a single platform, synchronously."""
run_callback_threadsafe(
self.hass.loop,
self.hass.loop.call_soon_threadsafe(
self._async_schedule_add_entities,
list(new_entities),
update_before_add,
).result()
)
@callback
def _async_schedule_add_entities(