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
18ab996f
Commit
18ab996f
authored
Aug 10, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring Geo::ScheduleWikiRepoUpdateService
parent
a5dd3dd4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
9 deletions
+3
-9
app/services/geo/schedule_wiki_repo_update_service.rb
app/services/geo/schedule_wiki_repo_update_service.rb
+1
-9
spec/services/geo/schedule_wiki_repo_update_service_spec.rb
spec/services/geo/schedule_wiki_repo_update_service_spec.rb
+2
-0
No files found.
app/services/geo/schedule_wiki_repo_update_service.rb
View file @
18ab996f
...
...
@@ -8,18 +8,10 @@ module Geo
def
execute
@projects
.
each
do
|
project
|
next
unless
can_update?
(
project
[
'id'
]
)
next
unless
Gitlab
::
Geo
.
current_node
&
.
projects_include?
(
project
[
'id'
].
to_i
)
GeoWikiRepositoryUpdateWorker
.
perform_async
(
project
[
'id'
],
project
[
'clone_url'
])
end
end
private
def
can_update?
(
project_id
)
return
true
if
Gitlab
::
Geo
.
current_node
&
.
restricted_project_ids
.
nil?
Gitlab
::
Geo
.
current_node
.
restricted_project_ids
.
include?
(
project_id
)
end
end
end
spec/services/geo/schedule_wiki_repo_update_service_spec.rb
View file @
18ab996f
...
...
@@ -16,6 +16,8 @@ describe Geo::ScheduleWikiRepoUpdateService do
subject
{
described_class
.
new
(
projects
)
}
it
"enqueues a batch of IDs of wiki's projects to have their wiki repositories updated"
do
create
(
:geo_node
,
:current
)
expect
(
GeoWikiRepositoryUpdateWorker
).
to
receive
(
:perform_async
)
.
once
.
with
(
project_1
.
id
,
'git@example.com:mike/diaspora.git'
).
and_return
(
spy
)
expect
(
GeoWikiRepositoryUpdateWorker
).
to
receive
(
:perform_async
)
...
...
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