synctl: print warning if synctl_cache_factor is set in config (#11865)

Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
This commit is contained in:
lukasdenk 2022-02-28 12:42:13 +01:00 committed by GitHub
parent b43c3ef8e2
commit ab3ef49059
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -0,0 +1 @@
Deprecate using `synctl` with the config option `synctl_cache_factor` and print a warning if a user still uses this option.

8
synctl
View File

@ -37,6 +37,13 @@ YELLOW = "\x1b[1;33m"
RED = "\x1b[1;31m"
NORMAL = "\x1b[m"
SYNCTL_CACHE_FACTOR_WARNING = """\
Setting 'synctl_cache_factor' in the config is deprecated. Instead, please do
one of the following:
- Either set the environment variable 'SYNAPSE_CACHE_FACTOR'
- or set 'caches.global_factor' in the homeserver config.
--------------------------------------------------------------------------------"""
def pid_running(pid):
try:
@ -228,6 +235,7 @@ def main():
start_stop_synapse = True
if cache_factor:
write(SYNCTL_CACHE_FACTOR_WARNING)
os.environ["SYNAPSE_CACHE_FACTOR"] = str(cache_factor)
cache_factors = config.get("synctl_cache_factors", {})