Sha256: 29750e9cfa740cee3633c8df1d1d3d5e69705bc6efb260769867dc0ae318c49a
Contents?: true
Size: 770 Bytes
Versions: 2
Compression:
Stored size: 770 Bytes
Contents
# frozen_string_literal: true module Sidekiq module JobSignal class ServerMiddleware include ::Sidekiq::ServerMiddleware def call(worker, _job, _queue) signalled = ::Sidekiq::JobSignal.quitting?(worker_class: worker.class.name, jid: worker.jid) logger.info "Sidekiq::JobSignal::ServerMiddleware.call: signalled=#{signalled}" if signalled def worker.perform(*args) logger.info "Turned #{jid}:#{self.class} into a no-op: #{args.inspect}" end end yield ensure logger.info "Sidekiq::JobSignal::ServerMiddleware.call: ensure signalled=#{signalled}" ::Sidekiq::JobSignal.handlers.each { |handler| handler.call(worker) } if signalled end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-job-signal-0.1.1 | lib/sidekiq/job_signal/server_middleware.rb |
sidekiq-job-signal-0.1.0 | lib/sidekiq/job_signal/server_middleware.rb |