1
0
mirror of https://github.com/elisspace/core.git synced 2026-08-29 15:43:55 +00:00

Don't dangle tasks in async decorator for WS API

This commit is contained in:
Paulus Schoutsen
2023-02-16 13:14:22 -05:00
parent bc2b35765e
commit 4e477eee33

View File

@@ -1,7 +1,6 @@
"""Decorators for the Websocket API."""
from __future__ import annotations
import asyncio
from collections.abc import Callable
from functools import wraps
from typing import Any
@@ -42,7 +41,7 @@ def async_response(
"""Schedule the handler."""
# As the webserver is now started before the start
# event we do not want to block for websocket responders
asyncio.create_task(_handle_async_response(func, hass, connection, msg))
hass.async_create_task(_handle_async_response(func, hass, connection, msg))
return schedule_handler