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

base.rb « strategies « duplicate_jobs « sidekiq_middleware « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9b3066bae6c1c10400b180d26c4edd04ab297160 (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
28
29
30
31
32
33
34
35
36
37
# frozen_string_literal: true

module Gitlab
  module SidekiqMiddleware
    module DuplicateJobs
      module Strategies
        class Base
          def initialize(duplicate_job)
            @duplicate_job = duplicate_job
          end

          def schedule(job)
            raise NotImplementedError
          end

          def perform(_job)
            raise NotImplementedError
          end

          private

          attr_reader :duplicate_job

          def strategy_name
            self.class.name.to_s.demodulize.underscore.humanize.downcase
          end

          def check!
            # The default expiry time is the worker class'
            # configured deduplication TTL or DuplicateJob::DEFAULT_DUPLICATE_KEY_TTL.
            duplicate_job.check!
          end
        end
      end
    end
  end
end