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

Print warning if synctl_cache_factor is set in config #11865

Merged
merged 8 commits into from
Feb 28, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/11865.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deprecate using `synctl` with the config option `synctl_cache_factor` and print a warning if a user still uses this option.
11 changes: 11 additions & 0 deletions synctl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import argparse
import collections
import errno
import glob
import logging
import os
import os.path
import signal
Expand All @@ -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.
lukasdenk marked this conversation as resolved.
Show resolved Hide resolved
--------------------------------------------------------------------------------"""

logger = logging.getLogger(__name__)


def pid_running(pid):
try:
Expand Down Expand Up @@ -228,6 +238,7 @@ def main():
start_stop_synapse = True

if cache_factor:
logger.warning(SYNCTL_CACHE_FACTOR_WARNING)
lukasdenk marked this conversation as resolved.
Show resolved Hide resolved
os.environ["SYNAPSE_CACHE_FACTOR"] = str(cache_factor)
H-Shay marked this conversation as resolved.
Show resolved Hide resolved

cache_factors = config.get("synctl_cache_factors", {})
Expand Down