diff options
author | Sean Quah <8349537+squahtx@users.noreply.github.com> | 2021-11-30 16:28:02 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-30 16:28:02 +0000 |
commit | 7ff22d6da41cd5ca80db95c18b409aea38e49fcd (patch) | |
tree | 99dbc2a8eb19b7c1ecf23665970d706a995e7b91 /synapse/events/utils.py | |
parent | Eliminate a few `Any`s in `LruCache` type hints (#11453) (diff) | |
download | synapse-7ff22d6da41cd5ca80db95c18b409aea38e49fcd.tar.xz |
Fix `LruCache` corruption bug with a `size_callback` that can return 0 (#11454)
When all entries in an `LruCache` have a size of 0 according to the provided `size_callback`, and `drop_from_cache` is called on a cache node, the node would be unlinked from the LRU linked list but remain in the cache dictionary. An assertion would be later be tripped due to the inconsistency. Avoid unintentionally calling `__len__` and use a strict `is None` check instead when unwrapping the weak reference.
Diffstat (limited to 'synapse/events/utils.py')
0 files changed, 0 insertions, 0 deletions