summary refs log tree commit diff
path: root/synapse/events/utils.py
diff options
context:
space:
mode:
authorSean Quah <8349537+squahtx@users.noreply.github.com>2021-11-30 16:28:02 +0000
committerGitHub <noreply@github.com>2021-11-30 16:28:02 +0000
commit7ff22d6da41cd5ca80db95c18b409aea38e49fcd (patch)
tree99dbc2a8eb19b7c1ecf23665970d706a995e7b91 /synapse/events/utils.py
parentEliminate a few `Any`s in `LruCache` type hints (#11453) (diff)
downloadsynapse-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