Commit c9a1a155 authored by Matija Čupić's avatar Matija Čupić

Fix N+1 in v3 builds API

The N+1 issue was caused by loading the job_artifacts_archive for each
job (build) individually. Including that in the builds
AssociationRelation fixed the issue.
parent 7e084984
......@@ -35,8 +35,7 @@ module API
get ':id/builds' do
builds = user_project.builds.order('id DESC')
builds = filter_builds(builds, params[:scope])
present paginate(builds), with: ::API::V3::Entities::Build
present paginate(builds.includes(:job_artifacts_archive)), with: ::API::V3::Entities::Build
end
desc 'Get builds for a specific commit of a project' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment