Optimise jobs queue processing for shared runners
Currently when a BuildRegisterService is executed we execute N*2 of queries due to tag matching. It's terribly slow as we can see here: https://performance.gitlab.net/dashboard/db/grape-endpoints?var-action=Grape%23POST%20%2Fbuilds%2Fregister&var-database=Production.
What is slow there, is that we are evaluating tags. Improve the jobs queue processing to pre-calculate as much os possible and improve the architecture of the solution.
MR: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/9511