diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-11-09 17:21:32 -0800 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-12-01 15:26:41 -0800 |
commit | c77a353dca25c2e08c409f1f3fc5a61a3eea69dc (patch) | |
tree | 2c05498e9fb7a5dc67f11efa277c44e254c0e4f6 | |
parent | 1807bc16466a37684c5e1de6b498230dfbd3be06 (diff) | |
download | gitlab-ce-c77a353dca25c2e08c409f1f3fc5a61a3eea69dc.tar.gz |
Remove unnecessary clearing
Since duplicate inserts are now ignored.
-rw-r--r-- | lib/gitlab/background_migration/prepare_untracked_uploads.rb | 5 | ||||
-rw-r--r-- | spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb | 4 |
2 files changed, 2 insertions, 7 deletions
diff --git a/lib/gitlab/background_migration/prepare_untracked_uploads.rb b/lib/gitlab/background_migration/prepare_untracked_uploads.rb index 6a7fef18e53..11978b73a8a 100644 --- a/lib/gitlab/background_migration/prepare_untracked_uploads.rb +++ b/lib/gitlab/background_migration/prepare_untracked_uploads.rb @@ -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 @@ -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) diff --git a/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb b/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb index 3d2504f84a1..cf1cad15c9a 100644 --- a/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb +++ b/spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb @@ -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 |