Repository navigation
Make it more clear how shared_extra_conf is combined in our Docker configuration scripts - #19323
Conversation
| # We combine `shared_config` second to avoid overwriting existing keys | ||
| # because TODO: why? | ||
| **shared_config, |
There was a problem hiding this comment.
I can't figure out why it matters that we don't want to overwrite existing keys here. The original context doesn't explain why either: matrix-org/synapse#14921 (comment)
synapse/docker/configure_workers_and_start.py
Lines 865 to 868 in f79acff
As far as I can tell, things would work just fine if we overwrote things.
For example, in this case, if we had multiple media workers, it doesn't matter if the first or last worker is the media_instance_running_background_jobs,
synapse/docker/configure_workers_and_start.py
Lines 127 to 131 in f79acff
(same story for all of the other worker types that define shared_extra_conf)
Am I missing something?
If not, we can update this to be even more standard.
If it's just for sanity sake (always use the first worker), that's a fine reason to document.
There was a problem hiding this comment.
I also don't see a reason for it. Let's simplify and check that CI still passes?
There was a problem hiding this comment.
If it's just for sanity sake (always use the first worker), that's a fine reason to document.
I've just gone with this as it reads the easiest. Explaining the nuance the other way is clunky and ultimately doesn't matter.
anoadragon453
left a comment
There was a problem hiding this comment.
Thanks for the great documentation improvements!
| # We combine `shared_config` second to avoid overwriting existing keys | ||
| # because TODO: why? | ||
| **shared_config, |
There was a problem hiding this comment.
I also don't see a reason for it. Let's simplify and check that CI still passes?
…nfig Conflicts: docker/configure_workers_and_start.py
| # Keep the `shared_config` up to date with the `shared_extra_conf` from each | ||
| # worker. | ||
| shared_config = { | ||
| **worker_config["shared_extra_conf"], | ||
| # We combine `shared_config` second to avoid overwriting existing keys | ||
| # because TODO: why? | ||
| # We combine `shared_config` second to avoid overwriting existing keys just | ||
| # for sanity sake (always use the first worker). | ||
| **shared_config, | ||
| } |
There was a problem hiding this comment.
For reference, this PR used to have this whole change in the diff.
But #19324 was merged first which introduced parts of it already.
Here is what this code used to look like:
synapse/docker/configure_workers_and_start.py
Lines 865 to 868 in 566670c
|
Thanks for the review @anoadragon453 🐡 |
Make it more clear how
shared_extra_confis combined in our Docker configuration scriptsOriginal context for why it was changed this way: matrix-org/synapse#14921 (comment)
Previously, this code made me question two things:
worker_config["shared_extra_conf"]in the templates?shared_extra_confhere. It's not used in theworker.yaml.j2template so all of this seemed a bit pointless.shared_extra_confitself is pointless and it's being done as a convenient place to mix the objects to get things right inshared_config(confusing).shared_configstarts out as an empty object, my first glance made me think we we're just updating with an empty object and then just re-assigning. But because we're in a loop, we actually accumulate theshared_extra_conffrom each worker.I'm not sure whether I'm capturing my confusion well enough here but basically, this made me spend time trying to figure out what/why we're doing things this way and we can use a more clear pattern to accomplish the same thing.
This change is spawning from looking at the
docker/configure_workers_and_start.pyscript in order to add a metrics listener (upcoming PR).Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.