diff options
author | Matija Čupić <matteeyah@gmail.com> | 2018-01-15 22:04:08 +0100 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2018-01-15 22:04:08 +0100 |
commit | feb3449709ce4fce62227f67233bc4d061c66ab5 (patch) | |
tree | 84484b257e2e73a6e2bc0f620884ac5373505188 /lib | |
parent | 8cef1f4cf169409cbc9d8e635c78284c2b3b037c (diff) | |
download | gitlab-ce-feb3449709ce4fce62227f67233bc4d061c66ab5.tar.gz |
Use preload instead of includes to avoid joinsbuilds-api-nplusone
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/jobs.rb | 2 | ||||
-rw-r--r-- | lib/api/v3/builds.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/api/jobs.rb b/lib/api/jobs.rb index 57bad74c105..9c205514b3a 100644 --- a/lib/api/jobs.rb +++ b/lib/api/jobs.rb @@ -38,7 +38,7 @@ module API builds = user_project.builds.order('id DESC') 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 end diff --git a/lib/api/v3/builds.rb b/lib/api/v3/builds.rb index 7bf7329625c..ac76fece931 100644 --- a/lib/api/v3/builds.rb +++ b/lib/api/v3/builds.rb @@ -36,7 +36,7 @@ module API builds = user_project.builds.order('id DESC') 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 end |