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

Commit

Permalink
Promote mark_filepath to constant
Browse files Browse the repository at this point in the history
  • Loading branch information
reivilibre committed Nov 16, 2023
1 parent a7d38e5 commit 48f98f0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions docker/configure_workers_and_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
MAIN_PROCESS_UNIX_SOCKET_PUBLIC_PATH = "/run/main_public.sock"
MAIN_PROCESS_UNIX_SOCKET_PRIVATE_PATH = "/run/main_private.sock"

# We place a file at this path to indicate that the script has already been
# run and should not be run again.
MARKER_FILE_PATH = "/conf/workers_have_been_configured"


@dataclass
class WorkerTemplate:
Expand Down Expand Up @@ -981,8 +985,8 @@ def main(args: List[str], environ: MutableMapping[str, str]) -> None:
log("Base homeserver config exists—not regenerating")
# This script may be run multiple times (mostly by Complement, see note at top of
# file). Don't re-configure workers in this instance.
mark_filepath = "/conf/workers_have_been_configured"
if not os.path.exists(mark_filepath):

if not os.path.exists(MARKER_FILE_PATH):
# Collect and validate worker_type requests
# Read the desired worker configuration from the environment
worker_types_env = environ.get("SYNAPSE_WORKER_TYPES", "").strip()
Expand All @@ -1001,7 +1005,7 @@ def main(args: List[str], environ: MutableMapping[str, str]) -> None:
generate_worker_files(environ, config_path, data_dir, requested_worker_types)

# Mark workers as being configured
with open(mark_filepath, "w") as f:
with open(MARKER_FILE_PATH, "w") as f:
f.write("")
else:
log("Worker config exists—not regenerating")
Expand Down

0 comments on commit 48f98f0

Please sign in to comment.