Closed
Bug 1808406
Opened 3 years ago
Closed 3 years ago
stop using functools cache decorators on methods
Categories
(Socorro :: General, task, P2)
Socorro
General
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: willkg, Assigned: willkg)
Details
Attachments
(1 file)
I found out that the functools cache decoratorated methods will include self as part of the cache key. Because of that, they cause those instances to stick around forever.
For example, this is bad:
from functools import cache
class Foo:
@cache
def calculate_things(self, a, b):
return a * b
This will cache all Foo instances where calculate_things was called thus keeping those Foo instances around forever.
We should stop using functools cache decorators on methods.
| Assignee | ||
Updated•3 years ago
|
Assignee: nobody → willkg
Status: NEW → ASSIGNED
| Assignee | ||
Comment 1•3 years ago
|
||
| Assignee | ||
Comment 2•3 years ago
|
||
| Assignee | ||
Comment 3•3 years ago
|
||
This was pushed to prod just now in bug #1809927. Marking as FIXED.
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•