forked from MirrorHub/synapse
Strip whitespace from worker types in Dockerfile-workers (#14165)
This commit is contained in:
parent
bc2bd92b93
commit
c75836fe77
2 changed files with 3 additions and 4 deletions
1
changelog.d/14165.docker
Normal file
1
changelog.d/14165.docker
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Prevent a class of database sharding errors when using `Dockerfile-workers` to spawn multiple instances of the same worker. Contributed by Jason Little.
|
|
@ -402,8 +402,8 @@ def generate_worker_files(
|
||||||
# No workers, just the main process
|
# No workers, just the main process
|
||||||
worker_types = []
|
worker_types = []
|
||||||
else:
|
else:
|
||||||
# Split type names by comma
|
# Split type names by comma, ignoring whitespace.
|
||||||
worker_types = worker_types_env.split(",")
|
worker_types = [x.strip() for x in worker_types_env.split(",")]
|
||||||
|
|
||||||
# Create the worker configuration directory if it doesn't already exist
|
# Create the worker configuration directory if it doesn't already exist
|
||||||
os.makedirs("/conf/workers", exist_ok=True)
|
os.makedirs("/conf/workers", exist_ok=True)
|
||||||
|
@ -422,8 +422,6 @@ def generate_worker_files(
|
||||||
|
|
||||||
# For each worker type specified by the user, create config values
|
# For each worker type specified by the user, create config values
|
||||||
for worker_type in worker_types:
|
for worker_type in worker_types:
|
||||||
worker_type = worker_type.strip()
|
|
||||||
|
|
||||||
worker_config = WORKERS_CONFIG.get(worker_type)
|
worker_config = WORKERS_CONFIG.get(worker_type)
|
||||||
if worker_config:
|
if worker_config:
|
||||||
worker_config = worker_config.copy()
|
worker_config = worker_config.copy()
|
||||||
|
|
Loading…
Reference in a new issue