bleak: cache BleakAdapter instances per event loop#1981
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1981 +/- ##
===========================================
+ Coverage 52.45% 52.64% +0.19%
===========================================
Files 43 43
Lines 4097 4118 +21
Branches 504 505 +1
===========================================
+ Hits 2149 2168 +19
- Misses 1817 1819 +2
Partials 131 131
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
dcceced to
7fde0a3
Compare
|
Three CI failures from trying real
Real Also added the Force-pushed 7fde0a3. |
|
I don't understand why we can't put the tests in the integration tests and avoid mocking the |
Other than the special case of BlueZ with more than one adapter being used by Bleak at the same time. |
7fde0a3 to
e8f3dae
Compare
|
Moved both tests to |
e8f3dae to
da4920c
Compare
I would expect calling |
Right - currently Easiest path: drop the differentiation test from this PR. |
da4920c to
0d007b6
Compare
0d007b6 to
68093f7
Compare
|
Tried |
68093f7 to
96a44a7
Compare
BleakAdapter.get() now returns the same BleakAdapter instance on repeated calls from the same event loop with the same adapter selection. The cache is keyed by (loop, PlatformBleakAdapter, cache_key), where cache_key is supplied by each backend (BlueZ uses bluez['adapter'] to differentiate; other backends return None for a single cache entry per loop). Mirrors the pattern in bleak.backends.bluezdbus.manager._global_instances introduced in 1be914c.
96a44a7 to
db24ab2
Compare
BleakAdapter.get()now returns the sameBleakAdapterinstance on repeated calls from the same event loop with the same adapter selection. The cache is keyed by (loop,PlatformBleakAdapter,adapter_path), so different adapters selected viabluez={"adapter": ...}get distinct instances.Mirrors the pattern in
bleak.backends.bluezdbus.manager._global_instancesintroduced in 1be914c.