Sha256: aea921d8a54b4aba47ec658ebda84c67bcbde7ced69a0bb686f3ee768b11a9d3

Contents?: true

Size: 613 Bytes

Versions: 3

Compression:

Stored size: 613 Bytes

Contents

module Notable
  module JobBackends
    class Sidekiq
      WRAPPER_CLASSES = Set.new(["ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper"])

      def call(worker, job, queue)
        name =
          if WRAPPER_CLASSES.include?(job["class"])
            job["args"].first["job_class"]
          else
            job["class"]
          end

        Notable.track_job name, job["jid"], queue, Time.at(job["enqueued_at"]) do
          yield
        end
      end
    end
  end
end

Sidekiq.configure_server do |config|
  config.server_middleware do |chain|
    chain.add Notable::JobBackends::Sidekiq
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
notable-0.0.3 lib/notable/job_backends/sidekiq.rb
notable-0.0.2 lib/notable/job_backends/sidekiq.rb
notable-0.0.1 lib/notable/job_backends/sidekiq.rb