Commit 7022bdef authored by Kerri Miller's avatar Kerri Miller

Merge branch 'kassio/bulkimports-reduce-memory-consumption-on-epics-pipeline' into 'master'

BulkImports: Reduce memory consumption when importing Epics

See merge request gitlab-org/gitlab!51595
parents 068bbadf fdf19bfc
......@@ -16,9 +16,9 @@ module EE
loader EE::BulkImports::Groups::Loaders::EpicsLoader
after_run do |context|
def after_run(context)
if context.entity.has_next_page?(:epics)
self.new.run(context)
run(context)
end
end
end
......
......@@ -26,15 +26,13 @@ RSpec.describe EE::BulkImports::Groups::Pipelines::EpicsPipeline do
subject { described_class.new }
it 'imports group epics into destination group' do
page1 = extractor_data(has_next_page: true, cursor: 'nextPageCursor')
page2 = extractor_data(has_next_page: false)
first_page = extractor_data(has_next_page: true, cursor: 'nextPageCursor')
last_page = extractor_data(has_next_page: false)
allow_next_instance_of(BulkImports::Common::Extractors::GraphqlExtractor) do |extractor|
if entity.has_next_page?(:epics)
allow(extractor).to receive(:extract).and_return(page2)
else
allow(extractor).to receive(:extract).and_return(page1)
end
allow(extractor)
.to receive(:extract)
.and_return(first_page, last_page)
end
expect { subject.run(context) }.to change(::Epic, :count).by(2)
......
......@@ -24,7 +24,7 @@ module BulkImports
end
end
after_run.call(context) if after_run.present?
after_run(context) if respond_to?(:after_run)
rescue MarkedAsFailedError
log_skip(context)
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