matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.82k stars 2.13k forks source link

Refactor the `configure_workers_and_start.py` script used internally by Complement. #16650

Open reivilibre opened 11 months ago

reivilibre commented 11 months ago

Base: develop

This pull request is intended for commit-by-commit review.

Original commit schedule, with full messages:

  1. Remove obsolete `"app"` from worker templates
  2. Convert worker templates into dataclass
  3. Use a lambda for the worker name rather than search and replace later
  4. Collapse WORKERS_CONFIG by removing entries with defaults
  5. Convert listener_resources and endpoint_patterns to Set[str]
  6. Tweak comments
  7. Add `merge_into`
  8. Remove special logic for adding stream_writers: just make it part of the extra config template
  9. Rename function to add_worker_to_instance_map given reduction of scope
  10. Add `sharding_allowed` to the WorkerTemplate rather than having a separate function for that
  11. Use `merge_into` when adding workers to the shared config
  12. Promote mark_filepath to constant
  13. Add a --generate-only option