20
20
# * SYNAPSE_SERVER_NAME: The desired server_name of the homeserver.
21
21
# * SYNAPSE_REPORT_STATS: Whether to report stats.
22
22
# * SYNAPSE_WORKER_TYPES: A comma separated list of worker names as specified in WORKER_CONFIG
23
- # below. Leave empty for no workers, or set to '*' for all possible workers .
23
+ # below. Leave empty for no workers.
24
24
# * SYNAPSE_AS_REGISTRATION_DIR: If specified, a directory in which .yaml and .yml files
25
25
# will be treated as Application Service registration files.
26
26
# * SYNAPSE_TLS_CERT: Path to a TLS certificate in PEM format.
58
58
# have to attach by instance_map to the master process and have client endpoints.
59
59
WORKERS_CONFIG : Dict [str , Dict [str , Any ]] = {
60
60
"pusher" : {
61
- "app" : "synapse.app.pusher " ,
61
+ "app" : "synapse.app.generic_worker " ,
62
62
"listener_resources" : [],
63
63
"endpoint_patterns" : [],
64
- "shared_extra_conf" : {"start_pushers" : False },
64
+ "shared_extra_conf" : {},
65
65
"worker_extra_conf" : "" ,
66
66
},
67
67
"user_dir" : {
84
84
"^/_synapse/admin/v1/media/.*$" ,
85
85
"^/_synapse/admin/v1/quarantine_media/.*$" ,
86
86
],
87
- "shared_extra_conf" : {"enable_media_repo" : False },
87
+ # The first configured media worker will run the media background jobs
88
+ "shared_extra_conf" : {
89
+ "enable_media_repo" : False ,
90
+ "media_instance_running_background_jobs" : "media_repository1" ,
91
+ },
88
92
"worker_extra_conf" : "enable_media_repo: true" ,
89
93
},
90
94
"appservice" : {
95
99
"worker_extra_conf" : "" ,
96
100
},
97
101
"federation_sender" : {
98
- "app" : "synapse.app.federation_sender " ,
102
+ "app" : "synapse.app.generic_worker " ,
99
103
"listener_resources" : [],
100
104
"endpoint_patterns" : [],
101
- "shared_extra_conf" : {"send_federation" : False },
105
+ "shared_extra_conf" : {},
102
106
"worker_extra_conf" : "" ,
103
107
},
104
108
"synchrotron" : {
205
209
"worker_extra_conf" : "" ,
206
210
},
207
211
"frontend_proxy" : {
208
- "app" : "synapse.app.frontend_proxy " ,
212
+ "app" : "synapse.app.generic_worker " ,
209
213
"listener_resources" : ["client" , "replication" ],
210
214
"endpoint_patterns" : ["^/_matrix/client/(api/v1|r0|v3|unstable)/keys/upload" ],
211
215
"shared_extra_conf" : {},
@@ -326,7 +330,7 @@ def add_worker_roles_to_shared_config(
326
330
worker_port : int ,
327
331
) -> None :
328
332
"""Given a dictionary representing a config file shared across all workers,
329
- append sharded worker information to it for the current worker_type instance.
333
+ append appropriate worker information to it for the current worker_type instance.
330
334
331
335
Args:
332
336
shared_config: The config dict that all worker instances share (after being converted to YAML)
@@ -359,7 +363,7 @@ def add_worker_roles_to_shared_config(
359
363
360
364
elif worker_type in ["account_data" , "presence" , "receipts" , "to_device" , "typing" ]:
361
365
# Update the list of stream writers
362
- # It's convienent that the name of the worker type is the same as the event stream
366
+ # It's convenient that the name of the worker type is the same as the stream to write
363
367
shared_config .setdefault ("stream_writers" , {}).setdefault (
364
368
worker_type , []
365
369
).append (worker_name )
@@ -371,10 +375,6 @@ def add_worker_roles_to_shared_config(
371
375
"port" : worker_port ,
372
376
}
373
377
374
- elif worker_type == "media_repository" :
375
- # The first configured media worker will run the media background jobs
376
- shared_config .setdefault ("media_instance_running_background_jobs" , worker_name )
377
-
378
378
379
379
def generate_base_homeserver_config () -> None :
380
380
"""Starts Synapse and generates a basic homeserver config, which will later be
@@ -483,8 +483,7 @@ def generate_worker_files(
483
483
if worker_config :
484
484
worker_config = worker_config .copy ()
485
485
else :
486
- log (worker_type + " is an unknown worker type! It will be ignored" )
487
- continue
486
+ error (worker_type + " is an unknown worker type! Please fix!" )
488
487
489
488
new_worker_count = worker_type_counter .setdefault (worker_type , 0 ) + 1
490
489
worker_type_counter [worker_type ] = new_worker_count
0 commit comments