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
252a4cee
Commit
252a4cee
authored
Nov 18, 2019
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Does not schedule duplicated jobs
parent
812ae292
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
ee/app/workers/geo/file_download_dispatch_worker.rb
ee/app/workers/geo/file_download_dispatch_worker.rb
+1
-1
ee/spec/workers/geo/file_download_dispatch_worker_spec.rb
ee/spec/workers/geo/file_download_dispatch_worker_spec.rb
+15
-0
No files found.
ee/app/workers/geo/file_download_dispatch_worker.rb
View file @
252a4cee
...
@@ -65,7 +65,7 @@ module Geo
...
@@ -65,7 +65,7 @@ module Geo
end
end
def
job_finders
def
job_finders
@job_finders
||=
[
[
Geo
::
FileDownloadDispatchWorker
::
AttachmentJobFinder
.
new
(
scheduled_file_ids
(
Gitlab
::
Geo
::
Replication
::
USER_UPLOADS_OBJECT_TYPES
)),
Geo
::
FileDownloadDispatchWorker
::
AttachmentJobFinder
.
new
(
scheduled_file_ids
(
Gitlab
::
Geo
::
Replication
::
USER_UPLOADS_OBJECT_TYPES
)),
Geo
::
FileDownloadDispatchWorker
::
LfsObjectJobFinder
.
new
(
scheduled_file_ids
(
:lfs
)),
Geo
::
FileDownloadDispatchWorker
::
LfsObjectJobFinder
.
new
(
scheduled_file_ids
(
:lfs
)),
Geo
::
FileDownloadDispatchWorker
::
JobArtifactJobFinder
.
new
(
scheduled_file_ids
(
:job_artifact
))
Geo
::
FileDownloadDispatchWorker
::
JobArtifactJobFinder
.
new
(
scheduled_file_ids
(
:job_artifact
))
...
...
ee/spec/workers/geo/file_download_dispatch_worker_spec.rb
View file @
252a4cee
...
@@ -42,6 +42,21 @@ describe Geo::FileDownloadDispatchWorker, :geo, :geo_fdw do
...
@@ -42,6 +42,21 @@ describe Geo::FileDownloadDispatchWorker, :geo, :geo_fdw do
subject
.
perform
subject
.
perform
end
end
it
'does not schedule duplicated jobs'
do
lfs_object_1
=
create
(
:lfs_object
,
:with_file
)
lfs_object_2
=
create
(
:lfs_object
,
:with_file
)
stub_const
(
'Geo::Scheduler::SchedulerWorker::DB_RETRIEVE_BATCH_SIZE'
,
5
)
secondary
.
update!
(
files_max_capacity:
2
)
allow
(
Gitlab
::
SidekiqStatus
).
to
receive
(
:job_status
).
with
([]).
and_return
([]).
twice
allow
(
Gitlab
::
SidekiqStatus
).
to
receive
(
:job_status
).
with
(
%w[123 456]
).
and_return
([
true
,
true
],
[
true
,
true
],
[
false
,
false
])
expect
(
Geo
::
FileDownloadWorker
).
to
receive
(
:perform_async
).
with
(
'lfs'
,
lfs_object_1
.
id
).
once
.
and_return
(
'123'
)
expect
(
Geo
::
FileDownloadWorker
).
to
receive
(
:perform_async
).
with
(
'lfs'
,
lfs_object_2
.
id
).
once
.
and_return
(
'456'
)
subject
.
perform
end
context
'with attachments (Upload records)'
do
context
'with attachments (Upload records)'
do
let
(
:upload
)
{
create
(
:upload
)
}
let
(
:upload
)
{
create
(
:upload
)
}
...
...
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