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
|
|
|
|
ATTRIBUTE_METHODS = {
|
2021-06-08 01:23:25 +05:30
|
|
|
name: :name,
|
2020-03-13 15:44:24 +05:30
|
|
|
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
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
def initialize(attributes = {})
|
2020-03-13 15:44:24 +05:30
|
|
|
@attributes = attributes
|
|
|
|
end
|
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
def generated_queue_name
|
|
|
|
@attributes[:queue]
|
|
|
|
end
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
def queue_namespace
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
ATTRIBUTE_METHODS.each do |attribute, meth|
|
|
|
|
define_method meth do
|
|
|
|
@attributes[attribute]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|