shenxn / libdyson

Python library for dyson devices
Apache License 2.0
64 stars 41 forks source link

Drop reference to mqtt client on disconnect #6

Closed graham33 closed 3 years ago

graham33 commented 3 years ago

Without this change, a circular reference will continue to exist between the Device object and the mqtt client object after disconnection. This shouldn't be a problem since Python can GC cyclic isolates, but it appears the del method of the mqtt client may be causing that to fail (e.g. by adding an external reference via a callback).

In any case, after adding this, unused libdyson Device and associated mqtt client objects seem to be cleaned up properly in my use-case.

Fixes shenxn/ha-dyson#34

codecov-io commented 3 years ago

Codecov Report

Merging #6 (6a38304) into main (299cfb1) will decrease coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main       #6      +/-   ##
==========================================
- Coverage   97.62%   97.62%   -0.01%     
==========================================
  Files          21       21              
  Lines         927      926       -1     
==========================================
- Hits          905      904       -1     
  Misses         22       22              
Impacted Files Coverage Δ
libdyson/dyson_device.py 97.05% <100.00%> (-0.02%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 299cfb1...6a38304. Read the comment docs.