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
bd6ef103
Commit
bd6ef103
authored
Sep 12, 2019
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove backward compatibility for Geo Sync worker
We used to pass a timestamp, now we pass a Hash
parent
cb6042bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
25 deletions
+2
-25
ee/app/workers/geo/project_sync_worker.rb
ee/app/workers/geo/project_sync_worker.rb
+2
-16
ee/spec/workers/geo/project_sync_worker_spec.rb
ee/spec/workers/geo/project_sync_worker_spec.rb
+0
-9
No files found.
ee/app/workers/geo/project_sync_worker.rb
View file @
bd6ef103
...
...
@@ -16,6 +16,8 @@ module Geo
# rubocop: disable CodeReuse/ActiveRecord
def
perform
(
project_id
,
options
=
{})
options
.
symbolize_keys!
registry
=
Geo
::
ProjectRegistry
.
find_or_initialize_by
(
project_id:
project_id
)
project
=
registry
.
project
...
...
@@ -30,8 +32,6 @@ module Geo
return
end
options
=
extract_options
(
registry
,
options
)
sync_repository
(
registry
,
options
)
sync_wiki
(
registry
,
options
)
end
...
...
@@ -48,19 +48,5 @@ module Geo
Geo
::
WikiSyncService
.
new
(
registry
.
project
).
execute
end
def
extract_options
(
registry
,
options
)
options
.
is_a?
(
Hash
)
?
options
.
symbolize_keys
:
backward_options
(
registry
,
options
)
end
# Before GitLab 11.8 we used to pass the scheduled time instead of an options hash,
# this method makes the job arguments backward compatible and
# can be removed in any version after GitLab 12.0.
def
backward_options
(
registry
,
schedule_time
)
{
sync_repository:
registry
.
repository_sync_due?
(
schedule_time
),
sync_wiki:
registry
.
wiki_sync_due?
(
schedule_time
)
}
end
end
end
ee/spec/workers/geo/project_sync_worker_spec.rb
View file @
bd6ef103
...
...
@@ -21,15 +21,6 @@ RSpec.describe Geo::ProjectSyncWorker do
.
with
(
instance_of
(
Project
)).
once
.
and_return
(
wiki_sync_service
)
end
context
'backward compatibility'
do
it
'performs sync for the given project when time is passed'
do
subject
.
perform
(
project
.
id
,
Time
.
now
)
expect
(
repository_sync_service
).
to
have_received
(
:execute
)
expect
(
wiki_sync_service
).
to
have_received
(
:execute
)
end
end
context
'when project could not be found'
do
it
'logs an error and returns'
do
expect
(
subject
).
to
receive
(
:log_error
).
with
(
"Couldn't find project, skipping syncing"
,
project_id:
999
)
...
...
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