Commit d8b361af authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'sh-speed-up-commit-loading' into 'master'

Speed up commit loads by disabling BatchLoader replace_methods

See merge request gitlab-org/gitlab-ce!29633
parents 13fe5b0d 18020f00
...@@ -94,7 +94,7 @@ class Commit ...@@ -94,7 +94,7 @@ class Commit
end end
def lazy(project, oid) def lazy(project, oid)
BatchLoader.for({ project: project, oid: oid }).batch do |items, loader| BatchLoader.for({ project: project, oid: oid }).batch(replace_methods: false) do |items, loader|
items_by_project = items.group_by { |i| i[:project] } items_by_project = items.group_by { |i| i[:project] }
items_by_project.each do |project, commit_ids| items_by_project.each do |project, commit_ids|
......
---
title: Speed up commit loads by disabling BatchLoader replace_methods
merge_request: 29633
author:
type: performance
...@@ -44,6 +44,14 @@ describe Commit do ...@@ -44,6 +44,14 @@ describe Commit do
expect(commit.id).to eq(oids[i]) expect(commit.id).to eq(oids[i])
end end
end end
it 'does not attempt to replace methods via BatchLoader' do
subject.each do |commit|
expect(commit).to receive(:method_missing).and_call_original
commit.id
end
end
end end
context 'when not found' do context 'when not found' do
......
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