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

strategies.rb « 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: 63e8bee4443d27c2b33241e05b119a3c91451406 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module Gitlab
  module SidekiqMiddleware
    module DuplicateJobs
      module Strategies
        UnknownStrategyError = Class.new(StandardError)

        STRATEGIES = {
          until_executing: UntilExecuting,
          until_executed: UntilExecuted,
          none: None
        }.freeze

        def self.for(name)
          STRATEGIES.fetch(name)
        rescue KeyError
          raise UnknownStrategyError, "Unknown deduplication strategy #{name}"
        end
      end
    end
  end
end