summary refs log tree commit diff
path: root/synapse/util/caches/deferred_cache.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2021-01-06 12:33:20 -0500
committerGitHub <noreply@github.com>2021-01-06 12:33:20 -0500
commit1b4d5d6acf8cfbe65601b881360ea730f9693d80 (patch)
treed46d801474518224611f46a0dd270257a9823469 /synapse/util/caches/deferred_cache.py
parentMerge tag 'v1.25.0rc1' into develop (diff)
downloadsynapse-1b4d5d6acf8cfbe65601b881360ea730f9693d80.tar.xz
Empty iterables should count towards cache usage. (#9028)
Diffstat (limited to 'synapse/util/caches/deferred_cache.py')
-rw-r--r--synapse/util/caches/deferred_cache.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/synapse/util/caches/deferred_cache.py b/synapse/util/caches/deferred_cache.py
index 601305487c..1adc92eb90 100644
--- a/synapse/util/caches/deferred_cache.py
+++ b/synapse/util/caches/deferred_cache.py
@@ -105,7 +105,7 @@ class DeferredCache(Generic[KT, VT]):
             keylen=keylen,
             cache_name=name,
             cache_type=cache_type,
-            size_callback=(lambda d: len(d)) if iterable else None,
+            size_callback=(lambda d: len(d) or 1) if iterable else None,
             metrics_collection_callback=metrics_cb,
             apply_cache_factor_from_config=apply_cache_factor_from_config,
         )  # type: LruCache[KT, VT]