Class: Projects::ContainerRepository::Gitlab::CleanupTagsService

Inherits:
CleanupTagsBaseService show all
Includes:
Timeoutable
Defined in:
app/services/projects/container_repository/gitlab/cleanup_tags_service.rb

Constant Summary collapse

TAGS_PAGE_SIZE =
1000

Constants included from Timeoutable

Timeoutable::DISABLED_TIMEOUTS, Timeoutable::TimeoutError

Instance Attribute Summary

Attributes inherited from BaseContainerService

#container, #current_user, #group, #params, #project

Instance Method Summary collapse

Methods inherited from BaseContainerService

#group_container?, #namespace_container?, #project_container?, #project_group

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

#can?

Constructor Details

#initialize(container_repository:, current_user: nil, params: {}) ⇒ CleanupTagsService

Returns a new instance of CleanupTagsService.



11
12
13
14
# File 'app/services/projects/container_repository/gitlab/cleanup_tags_service.rb', line 11

def initialize(container_repository:, current_user: nil, params: {})
  super
  @params = params.dup
end

Instance Method Details

#executeObject



16
17
18
19
20
21
22
23
24
# File 'app/services/projects/container_repository/gitlab/cleanup_tags_service.rb', line 16

def execute
  with_timeout do |start_time, result|
    container_repository.each_tags_page(page_size: TAGS_PAGE_SIZE) do |tags|
      execute_for_tags(tags, result)

      raise TimeoutError if !timeout_disabled? && timeout?(start_time)
    end
  end
end