From 2aeb305dc1d63e36064693d570a7983285a71bb1 Mon Sep 17 00:00:00 2001 From: mini-bomba <55105495+mini-bomba@users.noreply.github.com> Date: Fri, 31 Oct 2025 21:27:01 +0100 Subject: [PATCH] add option to disable worker name randomization --- utils/config.py | 3 +++ utils/misc.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/utils/config.py b/utils/config.py index cc9f70b..14e646a 100644 --- a/utils/config.py +++ b/utils/config.py @@ -48,6 +48,7 @@ class Config(TypedDict): front_auth: str | None floatie_auth: str | None debug: bool + randomize_worker_names: bool config: Config = yaml.safe_load(open("config.yaml" if not in_test() else "tests/test_config.yaml")) @@ -56,3 +57,5 @@ class Config(TypedDict): config["proxy_url"] = None if "proxy_token" not in config: config["proxy_token"] = None +if "randomize_worker_names" not in config: + config["randomize_worker_names"] = True diff --git a/utils/misc.py b/utils/misc.py index d758f34..2c2b3f2 100644 --- a/utils/misc.py +++ b/utils/misc.py @@ -2,6 +2,8 @@ from socket import gethostname import random +from .config import config + def random_hex(length: int) -> str: byte_count = math.ceil(length / 2) @@ -9,4 +11,6 @@ def random_hex(length: int) -> str: def generate_worker_name() -> str: - return f"{gethostname()}-{random_hex(4)}" + if config["randomize_worker_names"]: + return f"{gethostname()}-{random_hex(4)}" + return gethostname()