2020-03-13 15:44:24 +05:30
|
|
|
# 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?,
|
2020-04-08 14:13:33 +05:30
|
|
|
urgency: :get_urgency,
|
2020-03-13 15:44:24 +05:30
|
|
|
resource_boundary: :get_worker_resource_boundary,
|
2020-04-08 14:13:33 +05:30
|
|
|
idempotent: :idempotent?,
|
2020-06-23 00:09:42 +05:30
|
|
|
weight: :get_weight,
|
|
|
|
tags: :get_tags
|
2020-03-13 15:44:24 +05:30
|
|
|
}.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
|