-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Final piece to remove for generic_workers
blanket use.
#69
Comments
because, confusingly, this flag controls the master process. I like your approach of defining a |
Not completely done with it all, still brainstorming about it. BUT,
Is exactly what I do in my own repo lol A more professional answer: Because the first one may not necessarily be the one best suited for the job. In an ideal world, these might be on different machines(currently I understand this not to be the case. Something about storage providers and HDD access). Future-proofing. |
In the hunt for 'why?' synapse-unraid/synapse/app/homeserver.py Lines 236 to 250 in e15cab1
shows this can be switched to then worker section with no issues. It's counterpart,synapse-unraid/synapse/app/generic_worker.py Lines 355 to 377 in e15cab1
looks at config.media.can_load_media_repo instead, which feels inconsistent.
All these sections do is add the endpoint resources to the current instance, be it worker or master. |
I'm trying to find where. The only reference to
I'll be doing some source hacking to test this out, but I'm pretty sure just moving it into the |
Nevermind, I figured it out. When setting up a specific subsection(like "media" in this case) need to reference another, already established section through "root" because it's obviously not "self" until it's fully setup and passed through. |
Fun fact: the (Which means most of what I did above was pointless. Sigh. I suppose it'll be useful for refactoring to deal with the new possible |
Make media_repo be a
generic_worker
Quoted from the modernize configure workers script PR:
Having looked into this a bit more, it's slightly more involved than a simple removal.
Things we know:
In:
synapse-unraid/synapse/config/server.py
Lines 350 to 355 in fdb36e0
setup looks for
enable_media_repo
in the yaml, sets toTrue
by default, and adds it to theserver
section of ConfigObject.It is then passed into
/config/repository.py
at:synapse-unraid/synapse/config/repository.py
Lines 120 to 130 in fdb36e0
where
can_load_media_repo
is set for that single instance(in this case a worker). If set toTrue
then it enables the endpoint processing for media bits, according to comments in the source (included in "thing 1 above) also prevents cache cleanup inappropriately on master. Then it's added to themedia
section of the ConfigObject.can_load_media_repo
(specifically,(hs.config.|self.config|config.)media.can_load_media_repo
) is then used in potentially four other files. I think that's far enough for the purpose of this issue. This will be the last place to search for "True" or "False".synapse/rest/admin/__init__.py
synapse/app/generic_worker.py
synapse/app/_base.py
synapse/rest/media/v1/media_repository.py
media_instance_running_background_jobs
and assigns that worker_name to handle those tasks(which I believe is only url previews presently?)After pondering about this for a few days, I've come to the conclusion that there are two possible paths forward in order to remove
synapse.app.media_repository
from the source in "Thing 2" above. It will still need a yaml setting of some kind so that the worker knows it will be responsible for handling the media repo.enable_media_repo
. Right now, this is used to explicitly disable the media functions on master(and other workers). I think if it's put into the worker yaml fragment, that will be appropriate. Logic will have to be added to look for this, I recommend inrepository.py
next to the existing logic, for backwards compatibility.pusher_instances
andfederation_sender_instances
. A quick mockup would look like:Bonus to this approach would be that there would be no need for an
enable_media_repo
setting in potentially more than two other yaml files, it could be in either homeserver.yaml or shared.yaml. Additional opportunity exists to add themedia_instance_running_background_jobs
function to this at the same time and kill two birds with one stone.Additional questions:
enable_media_repo
in the server config section? Would it be more consistent to have it in workers?The text was updated successfully, but these errors were encountered: