@@ -371,27 +371,22 @@ def convert(src: str, dst: str, **template_vars: object) -> None:
371371 outfile .write (rendered )
372372
373373
374- def add_worker_roles_to_shared_config (
374+ def add_worker_to_instance_map (
375375 shared_config : dict ,
376376 worker_name : str ,
377377 worker_port : int ,
378378) -> None :
379- """Given a dictionary representing a config file shared across all workers,
380- append appropriate worker information to it for the current worker_type instance .
379+ """
380+ Update the shared config map to add the worker in the instance_map .
381381
382382 Args:
383383 shared_config: The config dict that all worker instances share (after being
384384 converted to YAML)
385385 worker_name: The name of the worker instance.
386386 worker_port: The HTTP replication port that the worker instance is listening on.
387387 """
388- # The instance_map config field marks the workers that write to various replication
389- # streams
390388 instance_map = shared_config .setdefault ("instance_map" , {})
391389
392- # Add all workers to the `instance_map`
393- # Technically only certain types of workers, such as stream writers, are needed
394- # here but it is simpler just to be consistent.
395390 if os .environ .get ("SYNAPSE_USE_UNIX_SOCKET" , False ):
396391 instance_map [worker_name ] = {
397392 "path" : f"/run/worker.{ worker_port } " ,
@@ -809,8 +804,10 @@ def generate_worker_files(
809804 else :
810805 healthcheck_urls .append ("http://localhost:%d/health" % (worker_port ,))
811806
812- # Update the shared config with sharding-related options if necessary
813- add_worker_roles_to_shared_config (shared_config , worker_name , worker_port )
807+ # Add all workers to the `instance_map`
808+ # Technically only certain types of workers, such as stream writers, are needed
809+ # here but it is simpler just to be consistent.
810+ add_worker_to_instance_map (shared_config , worker_name , worker_port )
814811
815812 # Enable the worker in supervisord
816813 worker_descriptors .append (worker_config )
0 commit comments