This instance will be upgraded to Heptapod 0.31.0 (final) on 2022-05-24 at 14:00 UTC+2 (a few minutes of down time)

Commit 8b22e5b2 authored by Michael Kozono's avatar Michael Kozono
Browse files

Remove unnecessary clearing

Since duplicate inserts are now ignored.
parent cc6ffd3f1386
......@@ -17,7 +17,6 @@ class UntrackedFile < ActiveRecord::Base
def perform
return unless migrate?
clear_untracked_file_paths
store_untracked_file_paths
schedule_populate_untracked_uploads_jobs
end
......@@ -28,10 +27,6 @@ def migrate?
UntrackedFile.table_exists?
end
def clear_untracked_file_paths
UntrackedFile.delete_all
end
def store_untracked_file_paths
return unless Dir.exist?(UPLOAD_DIR)
......
......@@ -68,14 +68,14 @@
# 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
......
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