Build project services in DB only when necessary
Right now when you create a project and view the project settings, Project#build_missing_services is run each time, presumably because this gives you a list of all the available services for the project that need to be used.
This has a number of problems:
- We bloat our
servicestable for unused entries - Downgrading from EE -> CE requires removing EE-only services that may never have been used
- Updating services when their fields change incurs a huge performance penalty (as noted in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/2572#note_15197436)
- This slows down the project creation
I think I remember @yorickpeterse or someone looking into this a while ago. Is there a reason we didn't go ahead and fix this?