Commit 19223db1 authored by drew cimino's avatar drew cimino

Preload projects to prevent N+1 when populating project name

parent 0e0c7376
......@@ -11,6 +11,8 @@ module Ci
validates :data, json_schema: { filename: "daily_build_group_report_result_data" }
scope :with_preloaded_projects, -> { preload(:project) }
def self.upsert_reports(data)
upsert_all(data, unique_by: :index_daily_build_group_report_results_unique_columns) if data.any?
end
......
---
title: Preload projects to prevent N+1 when populating project name
merge_request: 40769
author:
type: performance
......@@ -19,6 +19,10 @@ module Ci
private
def query
super.with_preloaded_projects
end
def query_allowed?
can?(current_user, :read_group_build_report_results, @group)
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