mopidy / mopidy-soundcloud

Mopidy extension for playing music from SoundCloud
https://mopidy.com/ext/soundcloud/
MIT License
185 stars 59 forks source link

Ignore flake8 B019. Doesn't apply as we have a single class instance. #132

Closed kingosticks closed 2 years ago

kingosticks commented 2 years ago

Ignore "B019 Use of functools.lru_cache or functools.cache on methods can lead to memory leaks. The cache may retain instance references, preventing garbage collection." which doesn't apply to our singleton class.

djmattyg007 commented 2 years ago

Was this actually a false positive? I don’t think functools is used in this codebase.

kingosticks commented 2 years ago

Yes but I think the underlying issue behind it is still present in our implementation.

djmattyg007 commented 2 years ago

I don’t use the Soundcloud extension so I’d be a little worried about trying to fix it. However, it does look like the problem wouldn’t be that difficult to fix.

It does have me wondering though - maybe it is somewhat desired behaviour to include self in the cache key 🤔

kingosticks commented 2 years ago

There's only ever one instance of the class and it lives for about as long as the whole application so we don't need it to be garbage collected and keeping a reference forever is fine. I don't think we need to do anything else here i.e. there is no problem and is why I am just ignoring the error.