Skip to content
Snippets Groups Projects

Draft: Test N+1 fix

Closed Pedro Pombeiro requested to merge pedropombeiro/test/96070 into master
1 unresolved thread
Files
3
+ 2
2
@@ -466,8 +466,8 @@ def self.latest_pipeline_per_commit(commits, ref = nil)
@@ -466,8 +466,8 @@ def self.latest_pipeline_per_commit(commits, ref = nil)
sql.index_by(&:sha)
sql.index_by(&:sha)
end
end
def self.latest_ids_per_project
def self.latest_per_project
group(:project_id).select('max(id) as id')
select("DISTINCT ON (project_id) id, project_id, status").order(:project_id, id: :desc)
end
end
def self.last_finished_for_ref_id(ci_ref_id)
def self.last_finished_for_ref_id(ci_ref_id)
Loading