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
7dae62cb
Commit
7dae62cb
authored
Nov 23, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor failure logging after merge with master
parent
79460248
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
21 deletions
+25
-21
app/services/geo/base_sync_service.rb
app/services/geo/base_sync_service.rb
+0
-6
app/services/geo/repository_sync_service.rb
app/services/geo/repository_sync_service.rb
+25
-15
No files found.
app/services/geo/base_sync_service.rb
View file @
7dae62cb
...
@@ -150,12 +150,6 @@ module Geo
...
@@ -150,12 +150,6 @@ module Geo
registry
.
update!
(
attrs
)
registry
.
update!
(
attrs
)
end
end
def
fail_registry
(
message
,
error
)
log_error
(
message
,
error
)
registry
.
update!
(
last_repository_sync_failure:
"
#{
message
}
:
#{
error
.
message
}
"
)
end
def
type
def
type
self
.
class
.
type
self
.
class
.
type
end
end
...
...
app/services/geo/repository_sync_service.rb
View file @
7dae62cb
...
@@ -20,22 +20,25 @@ module Geo
...
@@ -20,22 +20,25 @@ module Geo
else
else
project
.
ensure_repository
project
.
ensure_repository
fetch_geo_mirror
(
project
.
repository
)
fetch_geo_mirror
(
project
.
repository
)
end
update_registry
(
finished_at:
DateTime
.
now
)
end
log_info
(
'Finished repository sync'
,
update_registry
(
finished_at:
DateTime
.
now
)
update_delay_s:
update_delay_in_seconds
,
log_info
(
'Finished repository sync'
,
download_time_s:
download_time_in_seconds
)
update_delay_s:
update_delay_in_seconds
,
rescue
Gitlab
::
Shell
::
Error
,
download_time_s:
download_time_in_seconds
)
Gitlab
::
Git
::
RepositoryMirroring
::
RemoteError
,
rescue
Gitlab
::
Shell
::
Error
,
Geo
::
EmptyCloneUrlPrefixError
=>
e
Gitlab
::
Git
::
RepositoryMirroring
::
RemoteError
,
fail_registry
(
'Error syncing repository'
,
e
)
Geo
::
EmptyCloneUrlPrefixError
=>
e
registry
.
increment!
(
:repository_retry_count
)
rescue
Gitlab
::
Git
::
Repository
::
NoRepository
=>
e
fail_registry
(
'Error syncing repository'
,
e
)
fail_registry
(
'Invalid repository'
,
e
)
rescue
Gitlab
::
Git
::
Repository
::
NoRepository
=>
e
fail_registry
(
'Invalid repository'
,
e
)
log_info
(
'Setting force_to_redownload flag'
)
log_info
(
'Setting force_to_redownload flag'
)
registry
.
update
(
force_to_redownload_repository:
true
,
registry
.
update
(
force_to_redownload_repository:
true
)
repository_retry_count:
retry_count
+
1
)
log_info
(
'Expiring caches'
)
project
.
repository
.
after_create
log_info
(
'Expiring caches'
)
ensure
project
.
repository
.
after_create
ensure
clean_up_temporary_repository
if
redownload
clean_up_temporary_repository
if
redownload
end
end
...
@@ -52,6 +55,13 @@ module Geo
...
@@ -52,6 +55,13 @@ module Geo
project
.
repository
project
.
repository
end
end
def
fail_registry
(
message
,
error
)
log_error
(
message
,
error
)
registry
.
update!
(
last_repository_sync_failure:
"
#{
message
}
:
#{
error
.
message
}
"
,
repository_retry_count:
retry_count
+
1
)
end
def
retry_count
def
retry_count
registry
.
public_send
(
"
#{
type
}
_retry_count"
)
||
-
1
# rubocop:disable GitlabSecurity/PublicSend
registry
.
public_send
(
"
#{
type
}
_retry_count"
)
||
-
1
# rubocop:disable GitlabSecurity/PublicSend
end
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