From efcc3d8794e35cfc2c088d235d86acc555d9228d Mon Sep 17 00:00:00 2001 From: iops Date: Sat, 6 Dec 2025 10:57:16 +0200 Subject: [PATCH] set worker_name compatible with k8s horizontal pod autoscaling --- synapse/config/workers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/synapse/config/workers.py b/synapse/config/workers.py index ec8ab9506bc..82bf8eae12c 100644 --- a/synapse/config/workers.py +++ b/synapse/config/workers.py @@ -258,7 +258,10 @@ def read_config( ) self.worker_replication_secret = worker_replication_secret - self.worker_name = config.get("worker_name", self.worker_app) + from os import environ + self.worker_name = self.worker_app + if self.worker_app: + self.worker_name = config.get("worker_name", environ.get("HOSTNAME")) self.instance_name = self.worker_name or MAIN_PROCESS_INSTANCE_NAME # FIXME: Remove this check after a suitable amount of time.