From 6026a5e505e5f86fd915df3c54a460a1385fc2f5 Mon Sep 17 00:00:00 2001 From: lukasdenk Date: Mon, 31 Jan 2022 15:14:33 +0100 Subject: [PATCH 1/7] Print warning if synctl_cache_factor is set in config --- synctl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/synctl b/synctl index 0e54f4847bbd..60ec0b31bb32 100755 --- a/synctl +++ b/synctl @@ -18,6 +18,7 @@ import argparse import collections import errno import glob +import logging import os import os.path import signal @@ -37,6 +38,15 @@ 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 configs. +--------------------------------------------------------------------------------""" + +logger = logging.getLogger(__name__) + def pid_running(pid): try: @@ -228,6 +238,7 @@ def main(): start_stop_synapse = True if cache_factor: + logger.warning(SYNCTL_CACHE_FACTOR_WARNING) os.environ["SYNAPSE_CACHE_FACTOR"] = str(cache_factor) cache_factors = config.get("synctl_cache_factors", {}) From 7cc7037faac5a157d3768ed25da625ec380753e4 Mon Sep 17 00:00:00 2001 From: lukasdenk Date: Mon, 31 Jan 2022 15:23:33 +0100 Subject: [PATCH 2/7] Add Changelog --- changelog.d/11865.removal | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelog.d/11865.removal diff --git a/changelog.d/11865.removal b/changelog.d/11865.removal new file mode 100644 index 000000000000..fdd120f99ec1 --- /dev/null +++ b/changelog.d/11865.removal @@ -0,0 +1,4 @@ +Deprecate using `synctl` with the config option `synctl_cache_factor`. +Print a warning if a user still uses this option. Instead suggest the user to: + - Either set the environment variable 'SYNAPSE_CACHE_FACTOR' + - or set 'caches.global_factor' in the configs. From 869c34a321d3b5bcc90ffc657a5223b74a70f92a Mon Sep 17 00:00:00 2001 From: lukasdenk Date: Mon, 31 Jan 2022 15:28:56 +0100 Subject: [PATCH 3/7] Fix linting problems. --- synctl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/synctl b/synctl index 60ec0b31bb32..ec80069aa801 100755 --- a/synctl +++ b/synctl @@ -39,10 +39,10 @@ RED = "\x1b[1;31m" NORMAL = "\x1b[m" SYNCTL_CACHE_FACTOR_WARNING = """\ -Setting 'synctl_cache_factor' in the config is deprecated. Instead, please do +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 configs. + - or set 'caches.global_factor' in the configs. --------------------------------------------------------------------------------""" logger = logging.getLogger(__name__) From 78c6ce577c21c54889eb936c763e3de3e47d9be4 Mon Sep 17 00:00:00 2001 From: lukasdenk Date: Tue, 1 Feb 2022 11:16:25 +0100 Subject: [PATCH 4/7] Apply suggested changes to changelog --- changelog.d/11865.removal | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/changelog.d/11865.removal b/changelog.d/11865.removal index fdd120f99ec1..9fcabfc7200e 100644 --- a/changelog.d/11865.removal +++ b/changelog.d/11865.removal @@ -1,4 +1 @@ -Deprecate using `synctl` with the config option `synctl_cache_factor`. -Print a warning if a user still uses this option. Instead suggest the user to: - - Either set the environment variable 'SYNAPSE_CACHE_FACTOR' - - or set 'caches.global_factor' in the configs. +Deprecate using `synctl` with the config option `synctl_cache_factor` and print a warning if a user still uses this option. From 9f6e23d3240546578f1d3869c1a61ba5927ea8e3 Mon Sep 17 00:00:00 2001 From: lukasdenk <63459921+lukasdenk@users.noreply.github.com> Date: Mon, 7 Feb 2022 09:30:02 +0100 Subject: [PATCH 5/7] Change warning msg Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> --- synctl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synctl b/synctl index ec80069aa801..6427e8c3e765 100755 --- a/synctl +++ b/synctl @@ -42,7 +42,7 @@ 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 configs. + - or set 'caches.global_factor' in the homeserver config. --------------------------------------------------------------------------------""" logger = logging.getLogger(__name__) From 7384df8e4e5945e3f8b0f2f063fa77d1a96fafe5 Mon Sep 17 00:00:00 2001 From: lukasdenk Date: Thu, 17 Feb 2022 07:36:17 +0100 Subject: [PATCH 6/7] use write() instead of logger --- synctl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/synctl b/synctl index 6427e8c3e765..754def441ba3 100755 --- a/synctl +++ b/synctl @@ -45,8 +45,6 @@ one of the following: - or set 'caches.global_factor' in the homeserver config. --------------------------------------------------------------------------------""" -logger = logging.getLogger(__name__) - def pid_running(pid): try: @@ -238,7 +236,7 @@ def main(): start_stop_synapse = True if cache_factor: - logger.warning(SYNCTL_CACHE_FACTOR_WARNING) + write(SYNCTL_CACHE_FACTOR_WARNING) os.environ["SYNAPSE_CACHE_FACTOR"] = str(cache_factor) cache_factors = config.get("synctl_cache_factors", {}) From 1ad63d4d25b9b6b707486f69db0acf653bceb266 Mon Sep 17 00:00:00 2001 From: lukasdenk Date: Thu, 17 Feb 2022 21:18:03 +0100 Subject: [PATCH 7/7] fix linting probs --- synctl | 1 - 1 file changed, 1 deletion(-) diff --git a/synctl b/synctl index 754def441ba3..1ab36949c741 100755 --- a/synctl +++ b/synctl @@ -18,7 +18,6 @@ import argparse import collections import errno import glob -import logging import os import os.path import signal