Welcome to mirror list, hosted at ThFree Co, Russian Federation.

timeoutable.rb « gitlab « container_repository « projects « concerns « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 095f5aa7cfa22eb4eab3758e27a773c3e8424b79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

module Projects
  module ContainerRepository
    module Gitlab
      module Timeoutable
        extend ActiveSupport::Concern

        DISABLED_TIMEOUTS = [nil, 0].freeze

        TimeoutError = Class.new(StandardError)

        private

        def timeout?(start_time)
          return false if service_timeout.in?(DISABLED_TIMEOUTS)

          (Time.zone.now - start_time) > service_timeout
        end

        def service_timeout
          ::Gitlab::CurrentSettings.current_application_settings.container_registry_delete_tags_service_timeout
        end
      end
    end
  end
end