gitlab-org--gitlab-foss/lib/gitlab/sidekiq_middleware/monitor.rb
Qingyu Zhao eeeaebe608 Change Sidekiq monitor namespace
Move Gitlab::SidekiqMonitor to namespace Gitlab::SidekiqDaemon::Monitor
 - Class name and file name change
 - File path change to lib/gitlab/sidekiq_daemon/monitor.rb
 - Update class usage/reference in other files, including documentation
2019-09-11 00:11:54 +10:00

20 lines
529 B
Ruby

# frozen_string_literal: true
module Gitlab
module SidekiqMiddleware
class Monitor
def call(worker, job, queue)
Gitlab::SidekiqDaemon::Monitor.instance.within_job(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
end
end
end