Class: Gitlab::SidekiqMiddleware::WorkerContext::Server
- Inherits:
-
Object
- Object
- Gitlab::SidekiqMiddleware::WorkerContext::Server
- Includes:
- Gitlab::SidekiqMiddleware::WorkerContext
- Defined in:
- lib/gitlab/sidekiq_middleware/worker_context/server.rb
Instance Method Summary collapse
Instance Method Details
#call(worker, job, _queue, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/gitlab/sidekiq_middleware/worker_context/server.rb', line 9 def call(worker, job, _queue, &block) worker_class = find_worker(worker.class, job) # This is not a worker we know about, perhaps from a gem return yield unless worker_class.respond_to?(:get_worker_context) feature_category = worker_class.get_feature_category.to_s Gitlab::ApplicationContext.with_context(feature_category: feature_category) do # Use the context defined on the class level as the more specific context wrap_in_optional_context(worker_class.get_worker_context, &block) end end |