summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-04-26 10:50:15 +0100
committerErik Johnston <erik@matrix.org>2021-04-26 10:50:15 +0100
commit99fb72e63e75c55a969ae176213d3f6c689d880e (patch)
treebea56b53419c71e478fbeca5482b22f2d5c95e9d
parentMake TRACK_MEMORY_USAGE configurable (diff)
downloadsynapse-99fb72e63e75c55a969ae176213d3f6c689d880e.tar.xz
Move TRACK_MEMORY_USAGE to root
-rw-r--r--synapse/util/caches/__init__.py5
-rw-r--r--synapse/util/caches/lrucache.py6
2 files changed, 6 insertions, 5 deletions
diff --git a/synapse/util/caches/__init__.py b/synapse/util/caches/__init__.py

index 8e253cb518..b2504c2fad 100644 --- a/synapse/util/caches/__init__.py +++ b/synapse/util/caches/__init__.py
@@ -24,6 +24,11 @@ from synapse.config.cache import add_resizable_cache logger = logging.getLogger(__name__) + +# Whether to track estimated memory usage of the LruCaches. +TRACK_MEMORY_USAGE = False + + caches_by_name = {} # type: Dict[str, Sized] collectors_by_name = {} # type: Dict[str, CacheMetric] diff --git a/synapse/util/caches/lrucache.py b/synapse/util/caches/lrucache.py
index 1719b0a1ca..5fc26cedd2 100644 --- a/synapse/util/caches/lrucache.py +++ b/synapse/util/caches/lrucache.py
@@ -30,7 +30,7 @@ from typing import ( from typing_extensions import Literal from synapse.config import cache as cache_config -from synapse.util.caches import CacheMetric, register_cache +from synapse.util.caches import TRACK_MEMORY_USAGE, CacheMetric, register_cache from synapse.util.caches.treecache import TreeCache try: @@ -59,10 +59,6 @@ except ImportError: return 0 -# Whether to track estimated memory usage of the LruCaches. -TRACK_MEMORY_USAGE = False - - # Function type: the type used for invalidation callbacks FT = TypeVar("FT", bound=Callable[..., Any])