Skip to content

Improve performance of `/ci/builds/register.json`

Currently /ci/builds/register.json uses optimised SQL queries for doing fair scheduling or FIFO scheduling. However, it's also highly inefficient in second part where we do additional build rule checking using linear search over returned list of builds.

Here's the problematic code: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/services/ci/register_build_service.rb#L26