mirror of
https://github.com/home-assistant/core.git
synced 2026-04-22 14:45:27 +00:00
Fix race in bluetooth async_process_advertisements (#76176)
This commit is contained in:
committed by
Franck Nijhof
parent
11319defae
commit
60da54558e
@@ -188,7 +188,7 @@ async def async_process_advertisements(
|
||||
def _async_discovered_device(
|
||||
service_info: BluetoothServiceInfoBleak, change: BluetoothChange
|
||||
) -> None:
|
||||
if callback(service_info):
|
||||
if not done.done() and callback(service_info):
|
||||
done.set_result(service_info)
|
||||
|
||||
unload = async_register_callback(hass, _async_discovered_device, match_dict, mode)
|
||||
|
||||
@@ -856,6 +856,9 @@ async def test_process_advertisements_bail_on_good_advertisement(
|
||||
)
|
||||
|
||||
_get_underlying_scanner()._callback(device, adv)
|
||||
_get_underlying_scanner()._callback(device, adv)
|
||||
_get_underlying_scanner()._callback(device, adv)
|
||||
|
||||
await asyncio.sleep(0)
|
||||
|
||||
result = await handle
|
||||
|
||||
Reference in New Issue
Block a user