From 412414d4be95283a0b86ab5891d760bec87b8fd1 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Wed, 11 May 2022 13:06:13 +0100 Subject: [PATCH] Overly comprehensive docstring --- synapse/app/_base.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/synapse/app/_base.py b/synapse/app/_base.py index 8753553387f3..21e9847ee10e 100644 --- a/synapse/app/_base.py +++ b/synapse/app/_base.py @@ -488,6 +488,25 @@ def run_sighup(*args: Any, **kwargs: Any) -> None: def reload_cache_config(config: HomeServerConfig) -> None: + """Reload cache config from disk and immediately apply it.resize caches accordingly. + + If the config is invalid, a `ConfigError` is logged and no changes are made. + + Otherwise, this: + - replaces the `caches` section on the given `config` object, + - resizes all caches according to the new cache factors, and + - updates synapse.util.caches.TRACK_MEMORY_USAGE. + + Note that the following cache config keys are read, but not applied: + - event_cache_size: used to set a max_size and _original_max_size on + EventsWorkerStore._get_event_cache when it is created. We'd have to update + the _original_max_size (and maybe + - sync_response_cache_duration: would have to update the timeout_sec attribute on + HomeServer -> SyncHandler -> ResponseCache. + + Also, the HTTPConnectionPool in SimpleHTTPClient sets its maxPersistentPerHost + parameter based on the global_factor. This won't be applied on a config reload. + """ try: previous_cache_config = config.reload_config_section("caches") except ConfigError as e: