Class: Resqutils::StaleWorkersKiller
- Inherits:
-
Object
- Object
- Resqutils::StaleWorkersKiller
- Defined in:
- lib/resqutils/stale_workers_killer.rb
Overview
Vends stale workers that have been running “too long”
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ StaleWorkersKiller
constructor
A new instance of StaleWorkersKiller.
- #kill_stale_workers ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ StaleWorkersKiller
Returns a new instance of StaleWorkersKiller.
9 10 11 |
# File 'lib/resqutils/stale_workers_killer.rb', line 9 def initialize(={}) @stale_workers = .fetch(:stale_workers, Resqutils::StaleWorkers.new) end |
Class Method Details
.perform ⇒ Object
5 6 7 |
# File 'lib/resqutils/stale_workers_killer.rb', line 5 def self.perform self.new.kill_stale_workers end |
Instance Method Details
#kill_stale_workers ⇒ Object
12 13 14 15 16 |
# 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 |