summary refs log tree commit diff
path: root/synapse/util/caches/__init__.py
diff options
context:
space:
mode:
authorreivilibre <oliverw@matrix.org>2022-09-14 15:29:05 +0000
committerGitHub <noreply@github.com>2022-09-14 15:29:05 +0000
commitcf65433de26ecce551c64e56d9ee8435c99defab (patch)
treed849f60cd2df2660ced4818c43cc1c0ae6d008b6 /synapse/util/caches/__init__.py
parentRemove unused method in `synapse.api.auth.Auth`. (#13795) (diff)
downloadsynapse-cf65433de26ecce551c64e56d9ee8435c99defab.tar.xz
Fix a memory leak when running the unit tests. (#13798)
Diffstat (limited to 'synapse/util/caches/__init__.py')
-rw-r--r--synapse/util/caches/__init__.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/synapse/util/caches/__init__.py b/synapse/util/caches/__init__.py
index 35c0be08b0..f7c3a6794e 100644
--- a/synapse/util/caches/__init__.py
+++ b/synapse/util/caches/__init__.py
@@ -205,8 +205,9 @@ def register_cache(
         add_resizable_cache(cache_name, resize_callback)
 
     metric = CacheMetric(cache, cache_type, cache_name, collect_callback)
+    metric_name = "cache_%s_%s" % (cache_type, cache_name)
     caches_by_name[cache_name] = cache
-    CACHE_METRIC_REGISTRY.register_hook(metric.collect)
+    CACHE_METRIC_REGISTRY.register_hook(metric_name, metric.collect)
     return metric