Commit 8ee173a5 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'sh-speed-up-export' into 'master'

Speed up project exports by moving the archive to the cache dir

See merge request gitlab-org/gitlab!78986
parents df3e4041 23efa56b
...@@ -12,6 +12,10 @@ class ImportExportUploader < AttachmentUploader ...@@ -12,6 +12,10 @@ class ImportExportUploader < AttachmentUploader
end end
def move_to_cache def move_to_cache
# Exports create temporary files that we can safely move.
# Imports may be from project templates that we want to copy.
return super if mounted_as == :export_file
false false
end end
......
...@@ -10,6 +10,20 @@ RSpec.describe ImportExportUploader do ...@@ -10,6 +10,20 @@ RSpec.describe ImportExportUploader do
subject { described_class.new(model, :import_file) } subject { described_class.new(model, :import_file) }
context 'local store' do context 'local store' do
describe '#move_to_cache' do
it 'returns false' do
expect(subject.move_to_cache).to be false
end
context 'with project export' do
subject { described_class.new(model, :export_file) }
it 'returns true' do
expect(subject.move_to_cache).to be true
end
end
end
describe '#move_to_store' do describe '#move_to_store' do
it 'returns true' do it 'returns true' do
expect(subject.move_to_store).to be true expect(subject.move_to_store).to be true
...@@ -33,6 +47,20 @@ RSpec.describe ImportExportUploader do ...@@ -33,6 +47,20 @@ RSpec.describe ImportExportUploader do
let(:fixture) { File.join('spec', 'fixtures', 'group_export.tar.gz') } let(:fixture) { File.join('spec', 'fixtures', 'group_export.tar.gz') }
end end
describe '#move_to_cache' do
it 'returns false' do
expect(subject.move_to_cache).to be false
end
context 'with project export' do
subject { described_class.new(model, :export_file) }
it 'returns true' do
expect(subject.move_to_cache).to be false
end
end
end
describe '#move_to_store' do describe '#move_to_store' do
it 'returns false' do it 'returns false' do
expect(subject.move_to_store).to be false expect(subject.move_to_store).to be false
......
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