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
bd05c473
Commit
bd05c473
authored
Apr 06, 2018
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use symbols where possible, except for job args
parent
33279acb
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
22 deletions
+24
-22
ee/app/services/geo/file_registry_removal_service.rb
ee/app/services/geo/file_registry_removal_service.rb
+1
-1
ee/app/services/geo/file_service.rb
ee/app/services/geo/file_service.rb
+4
-4
ee/app/workers/geo/file_download_dispatch_worker.rb
ee/app/workers/geo/file_download_dispatch_worker.rb
+8
-7
ee/app/workers/geo/file_download_worker.rb
ee/app/workers/geo/file_download_worker.rb
+1
-1
ee/app/workers/geo/migrated_local_files_clean_up_worker.rb
ee/app/workers/geo/migrated_local_files_clean_up_worker.rb
+5
-4
ee/spec/workers/geo/file_download_worker_spec.rb
ee/spec/workers/geo/file_download_worker_spec.rb
+1
-1
ee/spec/workers/geo/migrated_local_files_clean_up_worker_spec.rb
.../workers/geo/migrated_local_files_clean_up_worker_spec.rb
+4
-4
No files found.
ee/app/services/geo/file_registry_removal_service.rb
View file @
bd05c473
...
...
@@ -76,7 +76,7 @@ module Geo
end
def
upload?
Geo
::
FileService
::
DEFAULT_OBJECT_TYPES
.
include?
(
object_type
)
Geo
::
FileService
::
DEFAULT_OBJECT_TYPES
.
include?
(
object_type
.
to_s
)
end
def
lease_key
...
...
ee/app/services/geo/file_service.rb
View file @
bd05c473
...
...
@@ -9,7 +9,7 @@ module Geo
DEFAULT_SERVICE_TYPE
=
'file'
.
freeze
def
initialize
(
object_type
,
object_db_id
)
@object_type
=
object_type
.
to_s
@object_type
=
object_type
.
to_s
ym
@object_db_id
=
object_db_id
end
...
...
@@ -21,19 +21,19 @@ module Geo
def
service_klass_name
klass_name
=
if
DEFAULT_OBJECT_TYPES
.
include?
(
object_type
)
if
DEFAULT_OBJECT_TYPES
.
include?
(
object_type
.
to_s
)
DEFAULT_SERVICE_TYPE
else
object_type
end
klass_name
.
camelize
klass_name
.
to_s
.
camelize
end
def
base_log_data
(
message
)
{
class:
self
.
class
.
name
,
object_type:
object_type
,
object_type:
object_type
.
to_s
,
object_db_id:
object_db_id
,
message:
message
}
...
...
ee/app/workers/geo/file_download_dispatch_worker.rb
View file @
bd05c473
...
...
@@ -60,7 +60,7 @@ module Geo
def
find_unsynced_lfs_objects_ids
(
batch_size
:)
lfs_objects_finder
.
find_unsynced_lfs_objects
(
batch_size:
batch_size
,
except_file_ids:
scheduled_file_ids
(
'lfs'
))
except_file_ids:
scheduled_file_ids
(
:lfs
))
.
pluck
(
:id
)
.
map
{
|
id
|
[
'lfs'
,
id
]
}
end
...
...
@@ -76,7 +76,7 @@ module Geo
def
find_unsynced_job_artifacts_ids
(
batch_size
:)
job_artifacts_finder
.
find_unsynced_job_artifacts
(
batch_size:
batch_size
,
except_artifact_ids:
scheduled_file_ids
(
'job_artifact'
))
except_artifact_ids:
scheduled_file_ids
(
:job_artifact
))
.
pluck
(
:id
)
.
map
{
|
id
|
[
'job_artifact'
,
id
]
}
end
...
...
@@ -92,7 +92,7 @@ module Geo
def
find_failed_lfs_objects_ids
(
batch_size
:)
lfs_objects_finder
.
find_failed_lfs_objects_registries
.
retry_due
.
where
.
not
(
file_id:
scheduled_file_ids
(
'lfs'
))
.
where
.
not
(
file_id:
scheduled_file_ids
(
:lfs
))
.
limit
(
batch_size
)
.
pluck
(
:file_id
).
map
{
|
id
|
[
'lfs'
,
id
]
}
end
...
...
@@ -100,7 +100,7 @@ module Geo
def
find_failed_artifacts_ids
(
batch_size
:)
job_artifacts_finder
.
find_failed_job_artifacts_registries
.
retry_due
.
where
.
not
(
artifact_id:
scheduled_file_ids
(
'job_artifact'
))
.
where
.
not
(
artifact_id:
scheduled_file_ids
(
:job_artifact
))
.
limit
(
batch_size
)
.
pluck
(
:artifact_id
).
map
{
|
id
|
[
'job_artifact'
,
id
]
}
end
...
...
@@ -116,7 +116,7 @@ module Geo
def
find_synced_missing_on_primary_lfs_objects_ids
(
batch_size
:)
lfs_objects_finder
.
find_synced_missing_on_primary_lfs_objects_registries
.
retry_due
.
where
.
not
(
file_id:
scheduled_file_ids
(
'lfs'
))
.
where
.
not
(
file_id:
scheduled_file_ids
(
:lfs
))
.
limit
(
batch_size
)
.
pluck
(
:file_id
).
map
{
|
id
|
[
'lfs'
,
id
]
}
end
...
...
@@ -124,15 +124,16 @@ module Geo
def
find_synced_missing_on_primary_job_artifacts_ids
(
batch_size
:)
job_artifacts_finder
.
find_synced_missing_on_primary_job_artifacts_registries
.
retry_due
.
where
.
not
(
artifact_id:
scheduled_file_ids
(
'job_artifact'
))
.
where
.
not
(
artifact_id:
scheduled_file_ids
(
:job_artifact
))
.
limit
(
batch_size
)
.
pluck
(
:artifact_id
).
map
{
|
id
|
[
'job_artifact'
,
id
]
}
end
def
scheduled_file_ids
(
file_types
)
file_types
=
Array
(
file_types
)
file_types
=
file_types
.
map
(
&
:to_s
)
scheduled_jobs
.
select
{
|
data
|
file_types
.
include?
(
data
[
:type
])
}.
map
{
|
data
|
data
[
:id
]
}
scheduled_jobs
.
select
{
|
data
|
file_types
.
include?
(
data
[
:type
]
.
to_s
)
}.
map
{
|
data
|
data
[
:id
]
}
end
end
end
ee/app/workers/geo/file_download_worker.rb
View file @
bd05c473
...
...
@@ -6,7 +6,7 @@ module Geo
sidekiq_options
retry:
3
,
dead:
false
def
perform
(
object_type
,
object_id
)
Geo
::
FileDownloadService
.
new
(
object_type
,
object_id
).
execute
Geo
::
FileDownloadService
.
new
(
object_type
.
to_sym
,
object_id
).
execute
end
end
end
ee/app/workers/geo/migrated_local_files_clean_up_worker.rb
View file @
bd05c473
...
...
@@ -20,7 +20,7 @@ module Geo
end
def
schedule_job
(
object_type
,
object_db_id
)
job_id
=
::
Geo
::
FileRegistryRemovalWorker
.
perform_async
(
object_type
,
object_db_id
)
job_id
=
::
Geo
::
FileRegistryRemovalWorker
.
perform_async
(
object_type
.
to_s
,
object_db_id
)
if
job_id
retval
=
{
id:
object_db_id
,
type:
object_type
,
job_id:
job_id
}
...
...
@@ -47,7 +47,7 @@ module Geo
lfs_objects_finder
.
find_migrated_local_lfs_objects
(
batch_size:
batch_size
,
except_file_ids:
scheduled_file_ids
(
:lfs
))
.
pluck
(
:id
)
.
map
{
|
id
|
[
:lfs
,
id
]
}
.
map
{
|
id
|
[
'lfs'
,
id
]
}
end
def
find_migrated_local_attachments_ids
(
batch_size
:)
...
...
@@ -63,13 +63,14 @@ module Geo
job_artifacts_finder
.
find_migrated_local_job_artifacts
(
batch_size:
batch_size
,
except_artifact_ids:
scheduled_file_ids
(
:job_artifact
))
.
pluck
(
:id
)
.
map
{
|
id
|
[
:job_artifact
,
id
]
}
.
map
{
|
id
|
[
'job_artifact'
,
id
]
}
end
def
scheduled_file_ids
(
file_types
)
file_types
=
Array
(
file_types
)
file_types
=
file_types
.
map
(
&
:to_s
)
scheduled_jobs
.
select
{
|
data
|
file_types
.
include?
(
data
[
:type
])
}.
map
{
|
data
|
data
[
:id
]
}
scheduled_jobs
.
select
{
|
data
|
file_types
.
include?
(
data
[
:type
]
.
to_s
)
}.
map
{
|
data
|
data
[
:id
]
}
end
def
attachments_object_store_enabled?
...
...
ee/spec/workers/geo/file_download_worker_spec.rb
View file @
bd05c473
...
...
@@ -5,7 +5,7 @@ describe Geo::FileDownloadWorker, :geo do
it
'instantiates and executes FileDownloadService'
do
service
=
double
(
:service
)
expect
(
service
).
to
receive
(
:execute
)
expect
(
Geo
::
FileDownloadService
).
to
receive
(
:new
).
with
(
'job_artifact'
,
1
).
and_return
(
service
)
expect
(
Geo
::
FileDownloadService
).
to
receive
(
:new
).
with
(
:job_artifact
,
1
).
and_return
(
service
)
described_class
.
new
.
perform
(
'job_artifact'
,
1
)
end
end
...
...
ee/spec/workers/geo/migrated_local_files_clean_up_worker_spec.rb
View file @
bd05c473
...
...
@@ -39,14 +39,14 @@ describe Geo::MigratedLocalFilesCleanUpWorker, :geo do
end
it
'schedules job for file stored remotely and synced locally'
do
expect
(
worker
).
to
receive
(
:schedule_job
).
with
(
:lfs
,
lfs_object_remote
.
id
)
expect
(
worker
).
to
receive
(
:schedule_job
).
with
(
'lfs'
,
lfs_object_remote
.
id
)
expect
(
worker
).
not_to
receive
(
:schedule_job
).
with
(
anything
,
lfs_object_local
.
id
)
worker
.
perform
end
it
'schedules worker for file stored remotely and synced locally'
do
expect
(
Geo
::
FileRegistryRemovalWorker
).
to
receive
(
:perform_async
).
with
(
:lfs
,
lfs_object_remote
.
id
)
expect
(
Geo
::
FileRegistryRemovalWorker
).
to
receive
(
:perform_async
).
with
(
'lfs'
,
lfs_object_remote
.
id
)
expect
(
Geo
::
FileRegistryRemovalWorker
).
not_to
receive
(
:perform_async
).
with
(
anything
,
lfs_object_local
.
id
)
worker
.
perform
...
...
@@ -127,14 +127,14 @@ describe Geo::MigratedLocalFilesCleanUpWorker, :geo do
end
it
'schedules job for artifact stored remotely and synced locally'
do
expect
(
worker
).
to
receive
(
:schedule_job
).
with
(
:job_artifact
,
job_artifact_remote
.
id
)
expect
(
worker
).
to
receive
(
:schedule_job
).
with
(
'job_artifact'
,
job_artifact_remote
.
id
)
expect
(
worker
).
not_to
receive
(
:schedule_job
).
with
(
anything
,
job_artifact_local
.
id
)
worker
.
perform
end
it
'schedules worker for artifact stored remotely and synced locally'
do
expect
(
Geo
::
FileRegistryRemovalWorker
).
to
receive
(
:perform_async
).
with
(
:job_artifact
,
job_artifact_remote
.
id
)
expect
(
Geo
::
FileRegistryRemovalWorker
).
to
receive
(
:perform_async
).
with
(
'job_artifact'
,
job_artifact_remote
.
id
)
expect
(
Geo
::
FileRegistryRemovalWorker
).
not_to
receive
(
:perform_async
).
with
(
anything
,
job_artifact_local
.
id
)
worker
.
perform
...
...
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