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

Commit b0e05ce

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 b0e05ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

synapse/config/cache.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
181181

182182
cache_config = config.get("caches") or {}
183183
self.global_factor = cache_config.get(
184-
"global_factor", properties.default_factor_size
184+
"global_factor", _DEFAULT_FACTOR_SIZE
185185
)
186186
if not isinstance(self.global_factor, (int, float)):
187187
raise ConfigError("caches.global_factor must be a number.")

0 commit comments

Comments
 (0)