mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Fix race in bluetooth async_process_advertisements (#76176)
This commit is contained in:
parent
63b454c9ed
commit
5d7cef6416
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user