From 0f02ce3563716659e0facb15e4c682970634d922 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 20 Jul 2018 10:00:09 -0700 Subject: [PATCH] Ensure a job preloads the project's namespace to avoid N+1 --- lib/api/jobs.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/api/jobs.rb b/lib/api/jobs.rb index e95b0dd5267..10c6e565f09 100644 --- a/lib/api/jobs.rb +++ b/lib/api/jobs.rb @@ -54,7 +54,7 @@ module API pipeline = user_project.pipelines.find(params[:pipeline_id]) builds = pipeline.builds builds = filter_builds(builds, params[:scope]) - builds = builds.preload(:job_artifacts_archive) + builds = builds.preload(:job_artifacts_archive, project: [:namespace]) present paginate(builds), with: Entities::Job end