`yunohost domain add` is lagging when there are many domains

On my yunohost server I have 74 domains, which may be a lot, but everything is continuing to work well, except for the command yunohost domain add, which takes up to five minutes to complete.

My hardware is a lenovo thinkcentre. So far my apps that are running are not actually overloaded – and mostly do not receive much traffic – its mostly many small websites and experiments.

So it just this one command yunohost domain add that is finding exceptional slowness. Everything else in the yunohost UI still runs smoothly. The yunohost domain add is slow both via the command line, and via the web interface. Although interestingly yunohost domain list returns instantly.

I wonder if there is something in yunohost domain add that is stuck in some slow loop or path that could be fixed? I could also potentially look at the code, if someone does not have an idea what the issue might be.

Five minutes to modify anything about the domain is actually quite a pain, when otherwise the system is operating smoothly.

Hello @notplants
When you add a new domain, a whole series of operations is executed for each domain and subdomain (regeneration, updating). So the more domains and subdomains there are, the longer the operation takes…
Yo can see them running yunohost domain add with --debug flag.

that’s very helpful @otm33 , and the --debug flag allows me to see what is taking all the time.

maybe I can look into making a fork for myself that adds a yunohost domain add --quick flag which simply adds a domain without regenerating all confs

from running with --debug, it appears the place it ends up hanging for the longest time, multiple times, is:

170628 DEBUG   ++ yunohost domain list --features mail_in mail_out --output-as json
170628 DEBUG   ++ jq -r '.domains[]'