class Resqutils::StaleWorkersKiller

Vends stale workers that have been running “too long”

Public Class Methods

new(options={}) click to toggle source
# File lib/resqutils/stale_workers_killer.rb, line 9
def initialize(options={})
  @stale_workers = options.fetch(:stale_workers, Resqutils::StaleWorkers.new)
end
perform() click to toggle source
# File lib/resqutils/stale_workers_killer.rb, line 5
def self.perform
  self.new.kill_stale_workers
end

Public Instance Methods

kill_stale_workers() click to toggle source
# File lib/resqutils/stale_workers_killer.rb, line 12
def kill_stale_workers
  @stale_workers.each do |worker|
    Resque.enqueue(Resqutils::WorkerKillerJob,worker.id)
  end
end