From f2a48d87df3129bd32597cb7e28496ade0fa8250 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Mon, 20 Aug 2018 13:01:46 +0100 Subject: [PATCH 1/2] Use get_cache_factor_for function for `state_cache` This allows the cache factor for `state_cache` to be individually specified in the enviroment --- synapse/state.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/synapse/state.py b/synapse/state.py index 8b92d4057a..0f2bedb694 100644 --- a/synapse/state.py +++ b/synapse/state.py @@ -29,7 +29,7 @@ from synapse.api.constants import EventTypes from synapse.api.errors import AuthError from synapse.events.snapshot import EventContext from synapse.util.async_helpers import Linearizer -from synapse.util.caches import CACHE_SIZE_FACTOR +from synapse.util.caches import get_cache_factor_for from synapse.util.caches.expiringcache import ExpiringCache from synapse.util.logutils import log_function from synapse.util.metrics import Measure @@ -40,7 +40,7 @@ logger = logging.getLogger(__name__) KeyStateTuple = namedtuple("KeyStateTuple", ("context", "type", "state_key")) -SIZE_OF_CACHE = int(100000 * CACHE_SIZE_FACTOR) +SIZE_OF_CACHE = 100000 * get_cache_factor_for("state_cache") EVICTION_TIMEOUT_SECONDS = 60 * 60 From 48a910e128a560a8572de403eeed19734367b8f6 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Mon, 20 Aug 2018 13:04:28 +0100 Subject: [PATCH 2/2] Newsfile --- changelog.d/3719.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/3719.bugfix diff --git a/changelog.d/3719.bugfix b/changelog.d/3719.bugfix new file mode 100644 index 0000000000..095d9288e8 --- /dev/null +++ b/changelog.d/3719.bugfix @@ -0,0 +1 @@ +Fix bug where `state_cache` cache factor ignored environment variables