mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 06:17:07 +00:00
Switch emulated_hue to use async_timeout instead of asyncio.wait_for (#78608)
This commit is contained in:
parent
f59c8d985d
commit
5cde3ca4e1
@ -11,6 +11,7 @@ import time
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
|
import async_timeout
|
||||||
|
|
||||||
from homeassistant import core
|
from homeassistant import core
|
||||||
from homeassistant.components import (
|
from homeassistant.components import (
|
||||||
@ -871,7 +872,8 @@ async def wait_for_state_change_or_timeout(
|
|||||||
unsub = async_track_state_change_event(hass, [entity_id], _async_event_changed)
|
unsub = async_track_state_change_event(hass, [entity_id], _async_event_changed)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await asyncio.wait_for(ev.wait(), timeout=STATE_CHANGE_WAIT_TIMEOUT)
|
async with async_timeout.timeout(STATE_CHANGE_WAIT_TIMEOUT):
|
||||||
|
await ev.wait()
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
pass
|
pass
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user