Use call_soon_threadsafe in face processing of image_processing (#106168)

This commit is contained in:
Jan-Philipp Benecke 2023-12-22 00:38:49 +01:00 committed by GitHub
parent e75357980a
commit 88ea5f7a54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,7 +24,6 @@ from homeassistant.helpers.config_validation import make_entity_service_schema
from homeassistant.helpers.entity import Entity, EntityDescription
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.typing import ConfigType
from homeassistant.util.async_ import run_callback_threadsafe
_LOGGER = logging.getLogger(__name__)
@ -233,9 +232,7 @@ class ImageProcessingFaceEntity(ImageProcessingEntity):
def process_faces(self, faces: list[FaceInformation], total: int) -> None:
"""Send event with detected faces and store data."""
run_callback_threadsafe(
self.hass.loop, self.async_process_faces, faces, total
).result()
self.hass.loop.call_soon_threadsafe(self.async_process_faces, faces, total)
@callback
def async_process_faces(self, faces: list[FaceInformation], total: int) -> None: