Closed kingosticks closed 2 years ago
Was this actually a false positive? I don’t think functools
is used in this codebase.
Yes but I think the underlying issue behind it is still present in our implementation.
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 🤔
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.
Ignore "B019 Use of
functools.lru_cache
orfunctools.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.