Sha256: 505d0f9a8e35b68c8b4e943dfa45e460b4e1110a0e14b42674f9231dc48c5bb7

Contents?: true

Size: 643 Bytes

Versions: 1

Compression:

Stored size: 643 Bytes

Contents

module Resqutils
  # Can be queued to kill a worker.  By default, will be queued to the 'worker_killer_job' queue, however
  # you can specify RESQUTILS_WORKER_KILLER_JOB_QUEUE in the environment to set an override.  Of course, you can always
  # forcibly enqueue it as needed.
  class WorkerKillerJob
    def self.queue
      @queue ||= begin
                   queue = String(ENV["RESQUTILS_WORKER_KILLER_JOB_QUEUE"]).strip
                   queue.length == 0 ? :worker_killer_job : queue
                 end
    end
    def self.perform(worker_id)
      Resque.workers.detect { |_| _.id == worker_id }.unregister_worker
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
resqutils-1.0.0 lib/resqutils/worker_killer_job.rb