Class: Projects::UpdateRemoteMirrorService
- Inherits:
-
BaseService
- Object
- BaseService
- Projects::UpdateRemoteMirrorService
- Includes:
- Gitlab::Utils::StrongMemoize
- Defined in:
- app/services/projects/update_remote_mirror_service.rb
Constant Summary collapse
- MAX_TRIES =
3
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
Methods inherited from BaseService
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
This class inherits a constructor from BaseService
Instance Method Details
#execute(remote_mirror, tries) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/services/projects/update_remote_mirror_service.rb', line 9 def execute(remote_mirror, tries) return success unless remote_mirror.enabled? # Blocked URLs are a hard failure, no need to attempt to retry if Gitlab::UrlBlocker.blocked_url?(normalized_url(remote_mirror.url), schemes: Project::VALID_MIRROR_PROTOCOLS) hard_retry_or_fail(remote_mirror, _('The remote mirror URL is invalid.'), tries) return error(remote_mirror.last_error) end update_mirror(remote_mirror) success rescue Gitlab::Git::CommandError => e # This happens if one of the gitaly calls above fail, for example when # branches have diverged, or the pre-receive hook fails. hard_retry_or_fail(remote_mirror, e., tries) error(e.) rescue StandardError => e remote_mirror.hard_fail!(e.) raise e end |