Commit ea4858cc authored by Gabriel Mazetto's avatar Gabriel Mazetto Committed by Robert Speicher

Codestyle and changelog changes

parent 5ec85f24
module Geo module Geo
class RepositoryUpdateService class RepositoryUpdateService
attr_reader :project, :clone_url attr_reader :project, :clone_url, :logger
LEASE_TIMEOUT = 1.hour.freeze LEASE_TIMEOUT = 1.hour.freeze
LEASE_KEY_PREFIX = 'geo_repository_fetch'.freeze LEASE_KEY_PREFIX = 'geo_repository_fetch'.freeze
def initialize(project, clone_url, logger = nil) def initialize(project, clone_url, logger = Rails.logger)
@project = project @project = project
@clone_url = clone_url @clone_url = clone_url
@logger = logger @logger = logger
...@@ -39,10 +39,8 @@ module Geo ...@@ -39,10 +39,8 @@ module Geo
begin begin
yield yield
ensure ensure
if repository_lease.present? log('Releasing leases to sync repository')
log('Releasing leases to sync repository') Gitlab::ExclusiveLease.cancel(lease_key, repository_lease)
Gitlab::ExclusiveLease.cancel(lease_key, repository_lease)
end
end end
end end
...@@ -53,9 +51,5 @@ module Geo ...@@ -53,9 +51,5 @@ module Geo
def log(message) def log(message)
logger.info("#{self.class.name}: #{message} for project #{project.path_with_namespace} (#{project.id})") logger.info("#{self.class.name}: #{message} for project #{project.path_with_namespace} (#{project.id})")
end end
def logger
@logger || Rails.logger
end
end end
end end
--- ---
title: Improve Repository Sync (with new SystemHook) title: Geo: Improve Repository Sync (with new SystemHook)
merge_request: 1789 merge_request: 1789
author: author:
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