Skip to content
Snippets Groups Projects
Commit c77a353d authored by Michael Kozono's avatar Michael Kozono
Browse files

Remove unnecessary clearing

Since duplicate inserts are now ignored.
parent 1807bc16
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -17,7 +17,6 @@ module Gitlab
def perform
return unless migrate?
 
clear_untracked_file_paths
store_untracked_file_paths
schedule_populate_untracked_uploads_jobs
end
Loading
Loading
@@ -28,10 +27,6 @@ module Gitlab
UntrackedFile.table_exists?
end
 
def clear_untracked_file_paths
UntrackedFile.delete_all
end
def store_untracked_file_paths
return unless Dir.exist?(UPLOAD_DIR)
 
Loading
Loading
Loading
Loading
@@ -68,14 +68,14 @@ describe Gitlab::BackgroundMigration::PrepareUntrackedUploads, :migration, :side
# E.g. from a previous failed run of this background migration
context 'when there is existing data in untracked_files_for_uploads' do
before do
untracked_files_for_uploads.create(path: '/foo/bar.jpg')
described_class.new.perform
end
 
it 'does not error or produce duplicates of existing data' do
Sidekiq::Testing.fake! do
expect do
described_class.new.perform
end.to change { untracked_files_for_uploads.count }.from(1).to(5)
end.not_to change { untracked_files_for_uploads.count }.from(5)
end
end
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment