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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/sidekiq_config/dummy_worker.rb')
-rw-r--r--lib/gitlab/sidekiq_config/dummy_worker.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/gitlab/sidekiq_config/dummy_worker.rb b/lib/gitlab/sidekiq_config/dummy_worker.rb
new file mode 100644
index 00000000000..858ff0db0c9
--- /dev/null
+++ b/lib/gitlab/sidekiq_config/dummy_worker.rb
@@ -0,0 +1,33 @@
+# 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?,
+ latency_sensitive: :latency_sensitive_worker?,
+ resource_boundary: :get_worker_resource_boundary,
+ weight: :get_weight
+ }.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