Sha256: 88959767d5b7cff24ba824f532dc35e74b2e4766f97564d5842c5560f62a6f45

Contents?: true

Size: 646 Bytes

Versions: 4

Compression:

Stored size: 646 Bytes

Contents

# frozen_string_literal: true

module LogsForMyFamily
  module Sidekiq
    class Client
      def call(worker_class, job, queue, redis_pool)
        logger = LogsForMyFamily.logger
        if logger
          job['logsformyfamily.context'] = {
            request_id: logger.request_id,
            queue: queue
          }
        end
        yield
      end
    end

    class Server
      def call(worker, job, queue)
        logger = LogsForMyFamily::Logger.new.set_client_request_info(job['logsformyfamily.context'])
        logger.set_request_id(job['jid'])
        LogsForMyFamily.logger = logger
        yield
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
logsformyfamily-0.3.0 lib/logsformyfamily/sidekiq.rb
logsformyfamily-0.2.3 lib/logsformyfamily/sidekiq.rb
logsformyfamily-0.2.2 lib/logsformyfamily/sidekiq.rb
logsformyfamily-0.2.1 lib/logsformyfamily/sidekiq.rb