Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add missing worker types to Complement worker-mode runs #14871

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/14871.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add more worker types in worker-enabled Complement runs.
4 changes: 4 additions & 0 deletions docker/complement/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ FROM $FROM
# We also initialize the database at build time, rather than runtime, so that it's faster to spin up the image.
RUN gosu postgres initdb --locale=C --encoding=UTF-8 --auth-host password

# Raise the number of maximum client connections to postgres.
# This is necessary when running Synapse in worker mode in Complement.
RUN echo "ALTER SYSTEM SET max_connections = '200'" | gosu postgres postgres --single

# Configure a password and create a database for Synapse
RUN echo "ALTER USER postgres PASSWORD 'somesecret'" | gosu postgres postgres --single
RUN echo "CREATE DATABASE synapse" | gosu postgres postgres --single
Expand Down
9 changes: 8 additions & 1 deletion docker/complement/conf/start_for_complement.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ if [[ -n "$SYNAPSE_COMPLEMENT_USE_WORKERS" ]]; then
# -n True if the length of string is non-zero.
# -z True if the length of string is zero.
if [[ -z "$SYNAPSE_WORKER_TYPES" ]]; then
# This list corresponds to the keys of the WORKERS_CONFIG dict in
# synapse/docker/configure_workers_and_start.py
export SYNAPSE_WORKER_TYPES="\
event_persister, \
event_persister, \
Expand All @@ -64,7 +66,12 @@ if [[ -n "$SYNAPSE_COMPLEMENT_USE_WORKERS" ]]; then
synchrotron, \
client_reader, \
appservice, \
pusher"
pusher, \
account_data, \
presence, \
receipts, \
to_device, \
typing"

fi
log "Workers requested: $SYNAPSE_WORKER_TYPES"
Expand Down
5 changes: 5 additions & 0 deletions docker/configure_workers_and_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
# Stream Writers require "client" and "replication" listeners because they
# have to attach by instance_map to the master process and have client endpoints.
WORKERS_CONFIG: Dict[str, Dict[str, Any]] = {
# NOTE: Any new entries added to this list should also be added to the
# SYNAPSE_WORKER_TYPES environment variable in
# docker/complement/conf/start_for_complement.sh in order to include
# those workers in the worker-mode Complement runs in CI, and when
# using scripts-dev/complement.sh locally.
"pusher": {
"app": "synapse.app.generic_worker",
"listener_resources": [],
Expand Down