mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
Switch yeelight to use async_timeout instead of asyncio.wait_for (#78606)
This commit is contained in:
parent
5cde3ca4e1
commit
82407ca433
@ -9,6 +9,7 @@ from ipaddress import IPv4Address
|
||||
import logging
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import async_timeout
|
||||
from async_upnp_client.search import SsdpSearchListener
|
||||
from async_upnp_client.utils import CaseInsensitiveDict
|
||||
|
||||
@ -154,7 +155,8 @@ class YeelightScanner:
|
||||
listener.async_search((host, SSDP_TARGET[1]))
|
||||
|
||||
with contextlib.suppress(asyncio.TimeoutError):
|
||||
await asyncio.wait_for(host_event.wait(), timeout=DISCOVERY_TIMEOUT)
|
||||
async with async_timeout.timeout(DISCOVERY_TIMEOUT):
|
||||
await host_event.wait()
|
||||
|
||||
self._host_discovered_events[host].remove(host_event)
|
||||
return self._host_capabilities.get(host)
|
||||
|
Loading…
x
Reference in New Issue
Block a user