Class: Projects::GitDeduplicationService
- Inherits:
-
BaseService
- Object
- BaseService
- Projects::GitDeduplicationService
- Includes:
- ExclusiveLeaseGuard
- Defined in:
- app/services/projects/git_deduplication_service.rb
Constant Summary collapse
- LEASE_TIMEOUT =
86400
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Attributes inherited from BaseService
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project) ⇒ GitDeduplicationService
constructor
A new instance of GitDeduplicationService.
Methods included from ExclusiveLeaseGuard
#exclusive_lease, #lease_release?, #lease_taken_log_level, #lease_taken_message, #log_lease_taken, #release_lease, #renew_lease!, #try_obtain_lease
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
#initialize(project) ⇒ GitDeduplicationService
Returns a new instance of GitDeduplicationService.
12 13 14 |
# File 'app/services/projects/git_deduplication_service.rb', line 12 def initialize(project) @project = project end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
10 11 12 |
# File 'app/services/projects/git_deduplication_service.rb', line 10 def project @project end |
Instance Method Details
#execute ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/services/projects/git_deduplication_service.rb', line 16 def execute try_obtain_lease do unless project.has_pool_repository? disconnect_git_alternates break end if source_project? && pool_can_fetch_from_source? fetch_from_source end project.link_pool_repository if same_storage_as_pool?(project.repository) end end |