Class: Gitlab::SidekiqConfig::DummyWorker

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/sidekiq_config/dummy_worker.rb

Overview

For queues that don’t have explicit workers - default and mailers

Constant Summary collapse

ATTRIBUTE_METHODS =
{
  name: :name,
  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

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DummyWorker

Returns a new instance of DummyWorker.



17
18
19
# File 'lib/gitlab/sidekiq_config/dummy_worker.rb', line 17

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

Instance Method Details

#context_for_argumentsObject



47
48
49
# File 'lib/gitlab/sidekiq_config/dummy_worker.rb', line 47

def context_for_arguments(*)
  nil
end

#feature_category_not_owned?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/gitlab/sidekiq_config/dummy_worker.rb', line 39

def feature_category_not_owned?
  true
end

#generated_queue_nameObject



21
22
23
# File 'lib/gitlab/sidekiq_config/dummy_worker.rb', line 21

def generated_queue_name
  @attributes[:queue]
end

#get_feature_categoryObject

All dummy workers are unowned; get the feature category from the context if available.



35
36
37
# File 'lib/gitlab/sidekiq_config/dummy_worker.rb', line 35

def get_feature_category
  Gitlab::ApplicationContext.current_context_attribute('meta.feature_category') || :not_owned
end

#get_worker_contextObject



43
44
45
# File 'lib/gitlab/sidekiq_config/dummy_worker.rb', line 43

def get_worker_context
  nil
end

#queueObject



25
26
27
# File 'lib/gitlab/sidekiq_config/dummy_worker.rb', line 25

def queue
  @attributes[:queue]
end

#queue_namespaceObject



29
30
31
# File 'lib/gitlab/sidekiq_config/dummy_worker.rb', line 29

def queue_namespace
  nil
end