mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
Make mqtt websocket subscribe use callback functions (#87885)
Nothing was being awaited so this was needlessly generating tasks when the callbacks fired
This commit is contained in:
parent
1d4d688af3
commit
753c7abaf4
@ -596,7 +596,8 @@ async def websocket_subscribe(
|
|||||||
if not connection.user.is_admin:
|
if not connection.user.is_admin:
|
||||||
raise Unauthorized
|
raise Unauthorized
|
||||||
|
|
||||||
async def forward_messages(mqttmsg: ReceiveMessage) -> None:
|
@callback
|
||||||
|
def forward_messages(mqttmsg: ReceiveMessage) -> None:
|
||||||
"""Forward events to websocket."""
|
"""Forward events to websocket."""
|
||||||
try:
|
try:
|
||||||
payload = cast(bytes, mqttmsg.payload).decode(
|
payload = cast(bytes, mqttmsg.payload).decode(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user