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

Use preload instead of includes to avoid joins

parent 8cef1f4c
...@@ -38,7 +38,7 @@ module API ...@@ -38,7 +38,7 @@ module API
builds = user_project.builds.order('id DESC') builds = user_project.builds.order('id DESC')
builds = filter_builds(builds, params[:scope]) builds = filter_builds(builds, params[:scope])
builds = builds.includes(:user, :job_artifacts_archive, :runner, pipeline: :project) builds = builds.preload(:user, :job_artifacts_archive, :runner, pipeline: :project)
present paginate(builds), with: Entities::Job present paginate(builds), with: Entities::Job
end end
......
...@@ -36,7 +36,7 @@ module API ...@@ -36,7 +36,7 @@ module API
builds = user_project.builds.order('id DESC') builds = user_project.builds.order('id DESC')
builds = filter_builds(builds, params[:scope]) builds = filter_builds(builds, params[:scope])
builds = builds.includes(:user, :job_artifacts_archive, :runner, pipeline: :project) builds = builds.preload(:user, :job_artifacts_archive, :runner, pipeline: :project)
present paginate(builds), with: ::API::V3::Entities::Build present paginate(builds), with: ::API::V3::Entities::Build
end end
......
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