Commit 9f560516 authored by Stan Hu's avatar Stan Hu

Refactor Geo repository and Wiki sync logging

parent bf89f1d9
......@@ -87,11 +87,23 @@ module Geo
end
def update_delay_in_seconds
raise NotImplementedError, 'This class should implement update_delay_in_seconds method'
# We don't track the last update time of repositories and Wiki
# separately in the main database
return unless project.last_repository_updated_at
(last_successful_sync_at.to_f - project.last_repository_updated_at.to_f).round(3)
end
def download_time_in_seconds
raise NotImplementedError, 'This class should implement download_time_in_seconds method'
(last_successful_sync_at.to_f - last_synced_at.to_f).round(3)
end
def last_successful_sync_at
registry.public_send("last_#{type}_successful_sync_at")
end
def last_synced_at
registry.public_send("last_#{type}_synced_at")
end
end
end
......@@ -38,15 +38,5 @@ module Geo
def ssh_url_to_repo
"#{primary_ssh_path_prefix}#{project.full_path}.git"
end
def update_delay_in_seconds
return unless project.last_repository_updated_at
(registry.last_repository_successful_sync_at.to_f - project.last_repository_updated_at.to_f).round(3)
end
def download_time_in_seconds
(registry.last_repository_successful_sync_at - registry.last_repository_synced_at).to_f.round(3)
end
end
end
......@@ -31,17 +31,5 @@ module Geo
def ssh_url_to_wiki
"#{primary_ssh_path_prefix}#{project.full_path}.wiki.git"
end
def update_delay_in_seconds
# We don't track the last update time of repositories and Wiki
# separately in the main database
return unless project.last_repository_updated_at
(registry.last_wiki_successful_sync_at.to_f - project.last_repository_updated_at.to_f).round(3)
end
def download_time_in_seconds
(registry.last_wiki_successful_sync_at - registry.last_wiki_synced_at).to_f.round(3)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment