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

dummy_worker.rb « sidekiq_config « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7568840410b02aef10872d5eef2079963f4838c1 (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
# frozen_string_literal: true

module Gitlab
  module SidekiqConfig
    # For queues that don't have explicit workers - default and mailers
    class DummyWorker
      attr_accessor :queue

      ATTRIBUTE_METHODS = {
        feature_category: :get_feature_category,
        has_external_dependencies: :worker_has_external_dependencies?,
        urgency: :get_urgency,
        resource_boundary: :get_worker_resource_boundary,
        idempotent: :idempotent?,
        weight: :get_weight,
        tags: :get_tags
      }.freeze

      def initialize(queue, attributes = {})
        @queue = queue
        @attributes = attributes
      end

      def queue_namespace
        nil
      end

      ATTRIBUTE_METHODS.each do |attribute, meth|
        define_method meth do
          @attributes[attribute]
        end
      end
    end
  end
end