Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
54769cf1
Commit
54769cf1
authored
Jun 13, 2019
by
Douglas Barbosa Alexandre
Committed by
Ash McKenzie
Jun 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the Geo::ExpireUploadsFinder
parent
2ee5fa5f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
75 deletions
+6
-75
ee/app/finders/geo/expire_uploads_finder.rb
ee/app/finders/geo/expire_uploads_finder.rb
+0
-17
ee/app/services/geo/files_expire_service.rb
ee/app/services/geo/files_expire_service.rb
+6
-6
ee/spec/finders/geo/expire_uploads_finder_spec.rb
ee/spec/finders/geo/expire_uploads_finder_spec.rb
+0
-52
No files found.
ee/app/finders/geo/expire_uploads_finder.rb
deleted
100644 → 0
View file @
2ee5fa5f
# frozen_string_literal: true
module
Geo
class
ExpireUploadsFinder
UPLOAD_TYPE
=
'file'
def
find_project_uploads
(
project
)
Geo
::
Fdw
::
Upload
.
for_model_with_type
(
project
,
UPLOAD_TYPE
)
end
def
find_file_registries_uploads
(
project
)
Gitlab
::
Geo
::
Fdw
::
UploadRegistryQueryBuilder
.
new
.
for_model
(
project
)
.
with_type
(
UPLOAD_TYPE
)
end
end
end
ee/app/services/geo/files_expire_service.rb
View file @
54769cf1
...
...
@@ -5,6 +5,7 @@ module Geo
include
::
Gitlab
::
Geo
::
LogHelpers
BATCH_SIZE
=
500
UPLOAD_TYPE
=
'file'
attr_reader
:project
,
:old_full_path
...
...
@@ -25,7 +26,7 @@ module Geo
def
execute
return
unless
Gitlab
::
Geo
.
secondary?
uploads
=
finder
.
find_project_uploads
(
project
)
uploads
=
Geo
::
Fdw
::
Upload
.
for_model_with_type
(
project
,
UPLOAD_TYPE
)
log_info
(
"Expiring replicated attachments after project rename"
,
count:
uploads
.
count
)
schedule_file_removal
(
uploads
)
...
...
@@ -58,11 +59,10 @@ module Geo
# rubocop: enable CodeReuse/ActiveRecord
def
mark_for_resync!
finder
.
find_file_registries_uploads
(
project
).
delete_all
end
def
finder
@finder
||=
::
Geo
::
ExpireUploadsFinder
.
new
Gitlab
::
Geo
::
Fdw
::
UploadRegistryQueryBuilder
.
new
.
for_model
(
project
)
.
with_type
(
UPLOAD_TYPE
)
.
delete_all
end
# This is called by LogHelpers to build json log with context info
...
...
ee/spec/finders/geo/expire_uploads_finder_spec.rb
deleted
100644 → 0
View file @
2ee5fa5f
require
'spec_helper'
describe
Geo
::
ExpireUploadsFinder
,
:geo
,
:geo_fdw
do
include
EE
::
GeoHelpers
let
(
:project
)
{
create
(
:project
)
}
describe
'#find_project_uploads'
do
context
'filtering per project uploads'
do
it
'returns only objects associated with the project'
do
other_upload
=
create
(
:upload
,
:issuable_upload
)
upload
=
create
(
:upload
,
:issuable_upload
,
model:
project
)
create
(
:geo_file_registry
,
file_id:
upload
.
id
)
create
(
:geo_file_registry
,
file_id:
other_upload
.
id
)
uploads
=
subject
.
find_project_uploads
(
project
)
expect
(
uploads
.
count
).
to
eq
(
1
)
expect
(
uploads
.
first
.
id
).
to
eq
(
upload
.
id
)
end
end
context
'filtering replicated uploads only'
do
it
'returns only replicated or to be replicated objects'
do
create
(
:upload
,
:issuable_upload
,
model:
project
)
upload
=
create
(
:upload
,
:issuable_upload
,
model:
project
)
create
(
:geo_file_registry
,
file_id:
upload
.
id
,
success:
false
)
uploads
=
subject
.
find_project_uploads
(
project
)
expect
(
uploads
.
count
).
to
eq
(
1
)
expect
(
uploads
.
first
.
id
).
to
eq
(
upload
.
id
)
end
end
end
describe
'#find_file_registries_uploads'
do
context
'filtering per project uploads'
do
it
'returns only objects associated with the project'
do
other_upload
=
create
(
:upload
,
:issuable_upload
)
upload
=
create
(
:upload
,
:issuable_upload
,
model:
project
)
create
(
:geo_file_registry
,
file_id:
other_upload
.
id
)
file_registry
=
create
(
:geo_file_registry
,
file_id:
upload
.
id
)
files
=
subject
.
find_file_registries_uploads
(
project
)
expect
(
files
.
count
).
to
eq
(
1
)
expect
(
files
.
first
.
id
).
to
eq
(
file_registry
.
id
)
end
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