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

worker_context.rb « sidekiq_middleware « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a5d92cf699c6e7c8b39fd2c7f3ee43bee0199048 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module Gitlab
  module SidekiqMiddleware
    module WorkerContext
      private

      def wrap_in_optional_context(context_or_nil, &block)
        return yield unless context_or_nil

        context_or_nil.use(&block)
      end

      def find_worker(worker_class, job)
        worker_name = (job['wrapped'].presence || worker_class).to_s

        Gitlab::SidekiqConfig::DEFAULT_WORKERS[worker_name]&.klass || worker_class
      end
    end
  end
end