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
574bb252
Commit
574bb252
authored
May 02, 2019
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address review comments: better names for variables
renamed `finish_sync!` and `start_registry!` methods
parent
34912b6f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
15 deletions
+15
-15
ee/app/models/geo/project_registry.rb
ee/app/models/geo/project_registry.rb
+3
-3
ee/app/services/geo/base_sync_service.rb
ee/app/services/geo/base_sync_service.rb
+2
-2
ee/app/services/geo/repository_sync_service.rb
ee/app/services/geo/repository_sync_service.rb
+4
-4
ee/app/services/geo/wiki_sync_service.rb
ee/app/services/geo/wiki_sync_service.rb
+4
-4
ee/spec/services/geo/repository_sync_service_spec.rb
ee/spec/services/geo/repository_sync_service_spec.rb
+1
-1
ee/spec/services/geo/wiki_sync_service_spec.rb
ee/spec/services/geo/wiki_sync_service_spec.rb
+1
-1
No files found.
ee/app/models/geo/project_registry.rb
View file @
574bb252
...
...
@@ -254,12 +254,12 @@ class Geo::ProjectRegistry < Geo::BaseRegistry
def
fail_sync!
(
type
,
message
,
error
,
attrs
=
{})
ensure_valid_type!
(
type
)
new_count
=
retry_count
(
type
)
+
1
new_
retry_
count
=
retry_count
(
type
)
+
1
attrs
[
"resync_
#{
type
}
"
]
=
true
attrs
[
"last_
#{
type
}
_sync_failure"
]
=
"
#{
message
}
:
#{
error
.
message
}
"
attrs
[
"
#{
type
}
_retry_count"
]
=
new_count
attrs
[
"
#{
type
}
_retry_at"
]
=
next_retry_time
(
new_count
)
attrs
[
"
#{
type
}
_retry_count"
]
=
new_
retry_
count
attrs
[
"
#{
type
}
_retry_at"
]
=
next_retry_time
(
new_
retry_
count
)
update!
(
attrs
)
end
...
...
ee/app/services/geo/base_sync_service.rb
View file @
574bb252
...
...
@@ -157,12 +157,12 @@ module Geo
)
end
def
start_registry!
def
start_registry
_sync
!
log_info
(
"Marking
#{
type
}
sync as started"
)
registry
.
start_sync!
(
type
)
end
def
fail_registry!
(
message
,
error
,
attrs
=
{})
def
fail_registry
_sync
!
(
message
,
error
,
attrs
=
{})
log_error
(
message
,
error
)
registry
.
fail_sync!
(
type
,
message
,
error
,
attrs
)
...
...
ee/app/services/geo/repository_sync_service.rb
View file @
574bb252
...
...
@@ -7,7 +7,7 @@ module Geo
private
def
sync_repository
start_registry!
start_registry
_sync
!
fetch_repository
update_root_ref
mark_sync_as_successful
...
...
@@ -16,17 +16,17 @@ module Geo
if
e
.
message
.
include?
Gitlab
::
GitAccess
::
ERROR_MESSAGES
[
:no_repo
]
if
repository_presumably_exists_on_primary?
log_info
(
'Repository is not found, but it seems to exist on the primary'
)
fail_registry!
(
'Repository is not found'
,
e
)
fail_registry
_sync
!
(
'Repository is not found'
,
e
)
else
log_info
(
'Repository is not found, marking it as successfully synced'
)
mark_sync_as_successful
(
missing_on_primary:
true
)
end
else
fail_registry!
(
'Error syncing repository'
,
e
)
fail_registry
_sync
!
(
'Error syncing repository'
,
e
)
end
rescue
Gitlab
::
Git
::
Repository
::
NoRepository
=>
e
log_info
(
'Setting force_to_redownload flag'
)
fail_registry!
(
'Invalid repository'
,
e
,
force_to_redownload_repository:
true
)
fail_registry
_sync
!
(
'Invalid repository'
,
e
,
force_to_redownload_repository:
true
)
log_info
(
'Expiring caches'
)
project
.
repository
.
after_create
...
...
ee/app/services/geo/wiki_sync_service.rb
View file @
574bb252
...
...
@@ -7,7 +7,7 @@ module Geo
private
def
sync_repository
start_registry!
start_registry
_sync
!
fetch_repository
mark_sync_as_successful
rescue
Gitlab
::
Shell
::
Error
,
Gitlab
::
Git
::
BaseError
,
ProjectWiki
::
CouldNotCreateWikiError
=>
e
...
...
@@ -16,17 +16,17 @@ module Geo
if
e
.
message
.
include?
Gitlab
::
GitAccess
::
ERROR_MESSAGES
[
:no_repo
]
if
repository_presumably_exists_on_primary?
log_info
(
'Wiki is not found, but it seems to exist on the primary'
)
fail_registry!
(
'Wiki is not found'
,
e
)
fail_registry
_sync
!
(
'Wiki is not found'
,
e
)
else
log_info
(
'Wiki is not found, marking it as successfully synced'
)
mark_sync_as_successful
(
missing_on_primary:
true
)
end
else
fail_registry!
(
'Error syncing wiki repository'
,
e
)
fail_registry
_sync
!
(
'Error syncing wiki repository'
,
e
)
end
rescue
Gitlab
::
Git
::
Repository
::
NoRepository
=>
e
log_info
(
'Setting force_to_redownload flag'
)
fail_registry!
(
'Invalid wiki'
,
e
,
force_to_redownload_wiki:
true
)
fail_registry
_sync
!
(
'Invalid wiki'
,
e
,
force_to_redownload_wiki:
true
)
ensure
expire_repository_caches
end
...
...
ee/spec/services/geo/repository_sync_service_spec.rb
View file @
574bb252
...
...
@@ -424,7 +424,7 @@ describe Geo::RepositorySyncService do
)
expect
(
project
.
repository
).
to
receive
(
:expire_exists_cache
).
twice
.
and_call_original
expect
(
subject
).
not_to
receive
(
:fail_registry!
)
expect
(
subject
).
not_to
receive
(
:fail_registry
_sync
!
)
subject
.
execute
end
...
...
ee/spec/services/geo/wiki_sync_service_spec.rb
View file @
574bb252
...
...
@@ -230,7 +230,7 @@ RSpec.describe Geo::WikiSyncService do
)
expect
(
project
.
wiki
.
repository
).
to
receive
(
:expire_exists_cache
).
twice
.
and_call_original
expect
(
subject
).
not_to
receive
(
:fail_registry!
)
expect
(
subject
).
not_to
receive
(
:fail_registry
_sync
!
)
subject
.
execute
end
...
...
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