bleak
bleak copied to clipboard
Cache service resolution on connect when using BlueZ/Dbus backend when requested
If the device was previously connected and we have the the service collection already built, it can be reused for the next connection if the device has not since been removed from the bus when the dangerous_use_bleak_cache flag is passed.
For devices that connect and disconnect frequently this can make operations up to an magnitude faster once the first connection has been made and the device has not been removed from the bus since the last connection.
In testing this significantly reduced the time it took to execute operations on Ble devices. The goal is to be able to quickly operate Bluetooth locks (and other similar devices)
This will not work with devices that suffer from the issues described in #882. We need to wait for "ServicesResolved" after connect to ensure that BlueZ is not longer adding or removing service/characteristic/descriptor d-bus objects.
I suppose we could make this opt-in for devices that are known to be well behaved (meaning they don't trigger the BlueZ bugs).
I reworked it to be opt-in and renamed it to be dangerous_use_bleak_cache
Thanks