Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 1febfd6

Browse files
author
David Robertson
committed
If global_factor is omitted, use 0.5 on reload
Consider the following scenario: 1. Start synapse with config that omits a `caches.global_factor`. 2. `CacheProperties.default_factor_size` is now 0.5. 3. Edit config to set `caches.global_factor = 2`. 4. Reload config. 5. Read `CacheProperties.default_factor_size`. - Without patch: still 2 - With patch: backt to 0.5 Without this commit, when we reload config we will compute `self.global_factor` to be the _previous_ global cache factor. I think this is surprising: I would that factor to reflect what the config file says.
1 parent 85f4385 commit 1febfd6

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

synapse/config/cache.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,7 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
180180
self.cache_factors: Dict[str, float] = {}
181181

182182
cache_config = config.get("caches") or {}
183-
self.global_factor = cache_config.get(
184-
"global_factor", properties.default_factor_size
185-
)
183+
self.global_factor = cache_config.get("global_factor", _DEFAULT_FACTOR_SIZE)
186184
if not isinstance(self.global_factor, (int, float)):
187185
raise ConfigError("caches.global_factor must be a number.")
188186

0 commit comments

Comments
 (0)