Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
233dec0fb17d
Commit
8b22e5b2
authored
Nov 09, 2017
by
Michael Kozono
Browse files
Remove unnecessary clearing
Since duplicate inserts are now ignored.
parent
cc6ffd3f1386
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/gitlab/background_migration/prepare_untracked_uploads.rb
View file @
233dec0f
...
...
@@ -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
)
...
...
spec/lib/gitlab/background_migration/prepare_untracked_uploads_spec.rb
View file @
233dec0f
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment