Class: Gitlab::SidekiqMiddleware::Monitor

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/sidekiq_middleware/monitor.rb

Instance Method Summary collapse

Instance Method Details

#call(worker, job, queue) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/gitlab/sidekiq_middleware/monitor.rb', line 8

def call(worker, job, queue)
  Gitlab::SidekiqDaemon::Monitor.instance.within_job(worker.class, job['jid'], queue) do
    yield
  end
rescue Gitlab::SidekiqDaemon::Monitor::CancelledError
  # push job to DeadSet
  payload = ::Sidekiq.dump_json(job)
  ::Sidekiq::DeadSet.new.kill(payload, notify_failure: false)

  # ignore retries
  raise ::Sidekiq::JobRetry::Skip
end