2929import os
3030import subprocess
3131import sys
32+ from typing import Any , Dict , Set
3233
3334import jinja2
3435import yaml
3536
3637MAIN_PROCESS_HTTP_LISTENER_PORT = 8080
3738
3839
39- WORKERS_CONFIG = {
40+ WORKERS_CONFIG : Dict [ str , Dict [ str , Any ]] = {
4041 "pusher" : {
4142 "app" : "synapse.app.pusher" ,
4243 "listener_resources" : [],
@@ -355,7 +356,7 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
355356 # worker_type: {1234, 1235, ...}}
356357 # }
357358 # and will be used to construct 'upstream' nginx directives.
358- nginx_upstreams = {}
359+ nginx_upstreams : Dict [ str , Set [ int ]] = {}
359360
360361 # A map of: {"endpoint": "upstream"}, where "upstream" is a str representing what will be
361362 # placed after the proxy_pass directive. The main benefit to representing this data as a
@@ -384,7 +385,7 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
384385 # A counter of worker_type -> int. Used for determining the name for a given
385386 # worker type when generating its config file, as each worker's name is just
386387 # worker_type + instance #
387- worker_type_counter = {}
388+ worker_type_counter : Dict [ str , int ] = {}
388389
389390 # For each worker type specified by the user, create config values
390391 for worker_type in worker_types :
@@ -404,7 +405,7 @@ def generate_worker_files(environ, config_path: str, data_dir: str):
404405 # e.g. federation_reader1
405406 worker_name = worker_type + str (new_worker_count )
406407 worker_config .update (
407- {"name" : worker_name , "port" : worker_port , "config_path" : config_path }
408+ {"name" : worker_name , "port" : str ( worker_port ) , "config_path" : config_path }
408409 )
409410
410411 # Update the shared config with any worker-type specific options
0 commit comments