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
9c0af147
Commit
9c0af147
authored
May 03, 2018
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return from Geo::ProjectSyncWorker#perform if storage is unhealthy
parent
2963bc01
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
0 deletions
+28
-0
ee/app/workers/geo/project_sync_worker.rb
ee/app/workers/geo/project_sync_worker.rb
+6
-0
ee/changelogs/unreleased/4957-projectsyncworker-should-skip-projects-that-have-a-broken-gitaly-shard.yml
...-should-skip-projects-that-have-a-broken-gitaly-shard.yml
+5
-0
ee/spec/workers/geo/project_sync_worker_spec.rb
ee/spec/workers/geo/project_sync_worker_spec.rb
+17
-0
No files found.
ee/app/workers/geo/project_sync_worker.rb
View file @
9c0af147
...
@@ -21,6 +21,12 @@ module Geo
...
@@ -21,6 +21,12 @@ module Geo
return
return
end
end
shard_name
=
project
.
repository_storage
unless
Gitlab
::
Geo
::
ShardHealthCache
.
healthy_shard?
(
shard_name
)
log_error
(
"Project shard '
#{
shard_name
}
' is unhealthy, skipping syncing"
,
project_id:
project_id
)
return
end
mark_disabled_wiki_as_synced
(
registry
)
mark_disabled_wiki_as_synced
(
registry
)
Geo
::
RepositorySyncService
.
new
(
project
).
execute
if
registry
.
repository_sync_due?
(
scheduled_time
)
Geo
::
RepositorySyncService
.
new
(
project
).
execute
if
registry
.
repository_sync_due?
(
scheduled_time
)
...
...
ee/changelogs/unreleased/4957-projectsyncworker-should-skip-projects-that-have-a-broken-gitaly-shard.yml
0 → 100644
View file @
9c0af147
---
title
:
Prevent Geo from unnecessarily syncing expired CI job artifacts
merge_request
:
author
:
type
:
performance
ee/spec/workers/geo/project_sync_worker_spec.rb
View file @
9c0af147
...
@@ -3,10 +3,17 @@ require 'rails_helper'
...
@@ -3,10 +3,17 @@ require 'rails_helper'
RSpec
.
describe
Geo
::
ProjectSyncWorker
do
RSpec
.
describe
Geo
::
ProjectSyncWorker
do
describe
'#perform'
do
describe
'#perform'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project_with_broken_storage
)
{
create
(
:project
,
:broken_storage
)
}
let
(
:repository_sync_service
)
{
spy
}
let
(
:repository_sync_service
)
{
spy
}
let
(
:wiki_sync_service
)
{
spy
}
let
(
:wiki_sync_service
)
{
spy
}
before
do
before
do
allow
(
Gitlab
::
Geo
::
ShardHealthCache
).
to
receive
(
:healthy_shard?
)
.
with
(
project
.
repository_storage
).
once
.
and_return
(
true
)
allow
(
Gitlab
::
Geo
::
ShardHealthCache
).
to
receive
(
:healthy_shard?
)
.
with
(
project_with_broken_storage
.
repository_storage
).
once
.
and_return
(
false
)
allow
(
Geo
::
RepositorySyncService
).
to
receive
(
:new
)
allow
(
Geo
::
RepositorySyncService
).
to
receive
(
:new
)
.
with
(
instance_of
(
Project
)).
once
.
and_return
(
repository_sync_service
)
.
with
(
instance_of
(
Project
)).
once
.
and_return
(
repository_sync_service
)
...
@@ -20,6 +27,16 @@ RSpec.describe Geo::ProjectSyncWorker do
...
@@ -20,6 +27,16 @@ RSpec.describe Geo::ProjectSyncWorker do
end
end
end
end
context
'when the shard associated to the project is unhealthy'
do
it
'logs an error and returns'
do
expect
(
subject
).
to
receive
(
:log_error
).
with
(
"Project shard '
#{
project_with_broken_storage
.
repository_storage
}
' is unhealthy, skipping syncing"
,
project_id:
project_with_broken_storage
.
id
)
expect
(
repository_sync_service
).
not_to
receive
(
:execute
)
expect
(
wiki_sync_service
).
not_to
receive
(
:execute
)
subject
.
perform
(
project_with_broken_storage
.
id
,
Time
.
now
)
end
end
context
'when project repositories has never been synced'
do
context
'when project repositories has never been synced'
do
it
'performs Geo::RepositorySyncService for the given project'
do
it
'performs Geo::RepositorySyncService for the given project'
do
subject
.
perform
(
project
.
id
,
Time
.
now
)
subject
.
perform
(
project
.
id
,
Time
.
now
)
...
...
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