diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2022-04-11 12:07:23 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-11 12:07:23 -0400 |
commit | 4586119f0b0901be64f08655d3aaaef289a51bde (patch) | |
tree | 8150ea6084a6a7a034d272654720333d01b75b9f /synapse/config/workers.py | |
parent | Enable certificate checking during complement tests (#12435) (diff) | |
download | synapse-4586119f0b0901be64f08655d3aaaef289a51bde.tar.xz |
Add missing type hints to config classes. (#12402)
Diffstat (limited to 'synapse/config/workers.py')
-rw-r--r-- | synapse/config/workers.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/synapse/config/workers.py b/synapse/config/workers.py index bdaba6db37..a5479dfca9 100644 --- a/synapse/config/workers.py +++ b/synapse/config/workers.py @@ -14,10 +14,12 @@ # limitations under the License. import argparse -from typing import List, Union +from typing import Any, List, Union import attr +from synapse.types import JsonDict + from ._base import ( Config, ConfigError, @@ -110,7 +112,7 @@ class WorkerConfig(Config): section = "worker" - def read_config(self, config, **kwargs): + def read_config(self, config: JsonDict, **kwargs: Any) -> None: self.worker_app = config.get("worker_app") # Canonicalise worker_app so that master always has None @@ -120,9 +122,13 @@ class WorkerConfig(Config): self.worker_listeners = [ parse_listener_def(x) for x in config.get("worker_listeners", []) ] - self.worker_daemonize = config.get("worker_daemonize") + self.worker_daemonize = bool(config.get("worker_daemonize")) self.worker_pid_file = config.get("worker_pid_file") - self.worker_log_config = config.get("worker_log_config") + + worker_log_config = config.get("worker_log_config") + if worker_log_config is not None and not isinstance(worker_log_config, str): + raise ConfigError("worker_log_config must be a string") + self.worker_log_config = worker_log_config # The host used to connect to the main synapse self.worker_replication_host = config.get("worker_replication_host", None) @@ -290,7 +296,7 @@ class WorkerConfig(Config): self.worker_name is None and background_tasks_instance == "master" ) or self.worker_name == background_tasks_instance - def generate_config_section(self, config_dir_path, server_name, **kwargs): + def generate_config_section(self, **kwargs: Any) -> str: return """\ ## Workers ## |