Class: Resqutils::WorkerKillerJob

Inherits:
Object
  • Object
show all
Defined in:
lib/resqutils/worker_killer_job.rb

Overview

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 Method Summary collapse

Class Method Details

.perform(worker_id) ⇒ Object


12
13
14
# File 'lib/resqutils/worker_killer_job.rb', line 12

def self.perform(worker_id)
  Resque.workers.select { |_| _.id == worker_id }.each(&:unregister_worker)
end

.queueObject


6
7
8
9
10
11
# File 'lib/resqutils/worker_killer_job.rb', line 6

def self.queue
  @queue ||= begin
               queue = String(ENV["RESQUTILS_WORKER_KILLER_JOB_QUEUE"]).strip
               queue.length == 0 ? :worker_killer_job : queue
             end
end