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
a3f1188e
Commit
a3f1188e
authored
Feb 16, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Track the last time a repository was successfully synced
[ci skip]
parent
12f089d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
8 deletions
+21
-8
app/services/geo/repository_backfill_service.rb
app/services/geo/repository_backfill_service.rb
+21
-8
No files found.
app/services/geo/repository_backfill_service.rb
View file @
a3f1188e
...
...
@@ -8,6 +8,22 @@ module Geo
def
execute
try_obtain_lease
do
synchronize
do
|
started_at
,
finished_at
|
registry
=
Geo
::
ProjectRegistry
.
find_or_create_by
(
project_id:
project
.
id
)
registry
.
last_repository_synced_at
=
started_at
registry
.
last_repository_successful_sync_at
=
finished_at
if
finished_at
registry
.
save
end
end
end
private
def
synchronize
started_at
=
DateTime
.
now
finished_at
=
nil
begin
project
.
create_repository
unless
project
.
repository_exists?
project
.
repository
.
after_create
if
project
.
empty_repo?
project
.
repository
.
fetch_geo_mirror
(
ssh_url_to_repo
)
...
...
@@ -15,16 +31,13 @@ module Geo
project
.
repository
.
expire_branch_cache
project
.
repository
.
expire_content_cache
# TODO: Check if it was successful or not
timestamp
=
DateTime
.
now
registry
=
Geo
::
ProjectRegistry
.
find_or_create_by
(
project_id:
project
.
id
)
registry
.
last_repository_synced_at
=
timestamp
registry
.
last_repository_successful_sync_at
=
timestamp
registry
.
save
finished_at
=
DateTime
.
now
rescue
Gitlab
::
Shell
::
Error
=>
e
Rails
.
logger
.
error
(
"Error backfilling repository
#{
project
.
path_with_namespace
}
:
#{
e
}
"
)
end
end
private
yield
started_at
,
finished_at
end
def
try_obtain_lease
uuid
=
Gitlab
::
ExclusiveLease
.
new
(
...
...
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