@@ -308,7 +308,7 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
308
308
309
309
Args:
310
310
environ: _Environ[str]
311
- config_path: Where to output the generated Synapse main worker config file.
311
+ config_path: The location of the generated Synapse main worker config file.
312
312
data_dir: The location of the synapse data directory. Where log and
313
313
user-facing config files live.
314
314
"""
@@ -321,7 +321,8 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
321
321
# and adding a replication listener.
322
322
323
323
# First read the original config file and extract the listeners block. Then we'll add
324
- # another listener for replication. Later we'll write out the result.
324
+ # another listener for replication. Later we'll write out the result to the shared
325
+ # config file.
325
326
listeners = [
326
327
{
327
328
"port" : 9093 ,
@@ -387,6 +388,10 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
387
388
# worker_type + instance #
388
389
worker_type_counter : Dict [str , int ] = {}
389
390
391
+ # A list of internal endpoints to healthcheck, starting with the main process
392
+ # which exists even if no workers do.
393
+ healthcheck_urls = ["http://localhost:8080/health" ]
394
+
390
395
# For each worker type specified by the user, create config values
391
396
for worker_type in worker_types :
392
397
worker_type = worker_type .strip ()
@@ -411,6 +416,8 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
411
416
# Update the shared config with any worker-type specific options
412
417
shared_config .update (worker_config ["shared_extra_conf" ])
413
418
419
+ healthcheck_urls .append ("http://localhost:%d/health" % (worker_port ,))
420
+
414
421
# Check if more than one instance of this worker type has been specified
415
422
worker_type_total_count = worker_types .count (worker_type )
416
423
if worker_type_total_count > 1 :
@@ -476,15 +483,10 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
476
483
# Determine the load-balancing upstreams to configure
477
484
nginx_upstream_config = ""
478
485
479
- # At the same time, prepare a list of internal endpoints to healthcheck
480
- # starting with the main process which exists even if no workers do.
481
- healthcheck_urls = ["http://localhost:8080/health" ]
482
-
483
486
for upstream_worker_type , upstream_worker_ports in nginx_upstreams .items ():
484
487
body = ""
485
488
for port in upstream_worker_ports :
486
489
body += " server localhost:%d;\n " % (port ,)
487
- healthcheck_urls .append ("http://localhost:%d/health" % (port ,))
488
490
489
491
# Add to the list of configured upstreams
490
492
nginx_upstream_config += NGINX_UPSTREAM_CONFIG_BLOCK .format (
0 commit comments