From b876a82575c7ebf652578e6280bd1f898d910550 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 16 Jun 2020 11:56:01 +0100 Subject: [PATCH] address review comments --- synapse/app/generic_worker.py | 7 ++++++- synapse/app/homeserver.py | 4 +++- synapse/config/server.py | 8 ++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/synapse/app/generic_worker.py b/synapse/app/generic_worker.py index 60688f6bc32f..f5e344da0d17 100644 --- a/synapse/app/generic_worker.py +++ b/synapse/app/generic_worker.py @@ -518,7 +518,12 @@ class GenericWorkerServer(HomeServer): def _listen_http(self, listener_config: ListenerConfig): port = listener_config.port bind_addresses = listener_config.bind_addresses - site_tag = listener_config.http_options.tag or port + + assert listener_config.http_options is not None + + site_tag = listener_config.http_options.tag + if site_tag is None: + site_tag = port resources = {} for res in listener_config.http_options.resources: for name in res.names: diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index 01f3a497e89d..d3ac398d6832 100644 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -95,7 +95,9 @@ def _listener_http(self, config: HomeServerConfig, listener_config: ListenerConf port = listener_config.port bind_addresses = listener_config.bind_addresses tls = listener_config.tls - site_tag = listener_config.http_options.tag or port + site_tag = listener_config.http_options.tag + if site_tag is None: + site_tag = port resources = {} for res in listener_config.http_options.resources: diff --git a/synapse/config/server.py b/synapse/config/server.py index cc9ce0360883..e88615ebdb8c 100644 --- a/synapse/config/server.py +++ b/synapse/config/server.py @@ -57,14 +57,14 @@ --------------------------------------------------------------------------------""" -KNOWN_LISTENER_TYPES = [ +KNOWN_LISTENER_TYPES = { "http", "metrics", "manhole", "replication", -] +} -KNOWN_RESOURCES = [ +KNOWN_RESOURCES = { "client", "consent", "federation", @@ -75,7 +75,7 @@ "replication", "static", "webclient", -] +} @attr.s(frozen=True)