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
aea9108a
Commit
aea9108a
authored
Aug 22, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log update delay and download times of repository sync
parent
44793b28
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
4 deletions
+21
-4
app/services/geo/base_sync_service.rb
app/services/geo/base_sync_service.rb
+6
-0
app/services/geo/repository_sync_service.rb
app/services/geo/repository_sync_service.rb
+7
-2
app/services/geo/wiki_sync_service.rb
app/services/geo/wiki_sync_service.rb
+6
-1
lib/gitlab/geo/project_log_helpers.rb
lib/gitlab/geo/project_log_helpers.rb
+2
-1
No files found.
app/services/geo/base_sync_service.rb
View file @
aea9108a
...
...
@@ -85,5 +85,11 @@ module Geo
def
type
self
.
class
.
type
end
def
update_delay
(
finish_time
)
return
unless
project
.
last_repository_updated_at
(
finish_time
.
to_f
-
project
.
last_repository_updated_at
.
to_f
).
round
(
3
)
end
end
end
app/services/geo/repository_sync_service.rb
View file @
aea9108a
...
...
@@ -11,13 +11,18 @@ module Geo
def
fetch_project_repository
log_info
(
'Fetching project repository'
)
update_registry
(
started_at:
DateTime
.
now
)
start_time
=
DateTime
.
now
update_registry
(
started_at:
start_time
)
begin
project
.
ensure_repository
project
.
repository
.
fetch_geo_mirror
(
ssh_url_to_repo
)
update_registry
(
finished_at:
DateTime
.
now
)
finish_time
=
DateTime
.
now
log_info
(
"Finished repository sync"
,
update_delay_s:
update_delay
(
finish_time
),
download_time_s:
(
finish_time
-
start_time
).
to_f
.
round
(
3
))
update_registry
(
finished_at:
finish_time
)
rescue
Gitlab
::
Shell
::
Error
,
Geo
::
EmptyCloneUrlPrefixError
=>
e
log_error
(
'Error syncing repository'
,
e
)
rescue
Gitlab
::
Git
::
Repository
::
NoRepository
=>
e
...
...
app/services/geo/wiki_sync_service.rb
View file @
aea9108a
...
...
@@ -10,12 +10,17 @@ module Geo
def
fetch_wiki_repository
log_info
(
'Fetching wiki repository'
)
update_registry
(
started_at:
DateTime
.
now
)
start_time
=
DateTime
.
now
update_registry
(
started_at:
start_time
)
begin
project
.
wiki
.
ensure_repository
project
.
wiki
.
repository
.
fetch_geo_mirror
(
ssh_url_to_wiki
)
finish_time
=
DateTime
.
now
log_info
(
"Finished wiki sync"
,
update_delay_s:
update_delay
(
finish_time
),
download_time_s:
(
finish_time
-
start_time
).
to_f
.
round
(
3
))
update_registry
(
finished_at:
DateTime
.
now
)
rescue
Gitlab
::
Git
::
Repository
::
NoRepository
,
Gitlab
::
Shell
::
Error
,
...
...
lib/gitlab/geo/project_log_helpers.rb
View file @
aea9108a
module
Gitlab
module
Geo
module
ProjectLogHelpers
def
log_info
(
message
)
def
log_info
(
message
,
details
=
{}
)
data
=
base_log_data
(
message
)
data
.
merge!
(
details
)
if
details
Gitlab
::
Geo
::
Logger
.
info
(
data
)
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