File tree 1 file changed +10
-1
lines changed
src/bleak_esphome/backend
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,16 @@ def async_on_raw_advertisements(
38
38
) -> None :
39
39
"""Call the registered callback."""
40
40
now = MONOTONIC_TIME ()
41
- for adv in raw .advertisements :
41
+ advertisements = raw .advertisements
42
+ # We avoid __iter__ on the protobuf object because
43
+ # the the protobuf library has an expensive internal
44
+ # debug logging when it reaches the end of a repeated field.
45
+ # https://github.com/Bluetooth-Devices/bleak-esphome/pull/90
46
+ # To work around this we use a for loop to iterate over
47
+ # the repeated field since `PyUpb_RepeatedContainer_Subscript`
48
+ # does not trigger the debug logging.
49
+ for i in range (len (advertisements )):
50
+ adv = advertisements [i ]
42
51
self ._async_on_advertisement (
43
52
int_to_bluetooth_address (adv .address ),
44
53
adv .rssi ,
You can’t perform that action at this time.
0 commit comments