Class: Stormtroopers::DelayedJobFactory
- Defined in:
- lib/stormtroopers/factory/delayed_job.rb
Instance Attribute Summary
Attributes inherited from Factory
Instance Method Summary collapse
Methods inherited from Factory
Constructor Details
This class inherits a constructor from Stormtroopers::Factory
Instance Method Details
#produce ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/stormtroopers/factory/delayed_job.rb', line 3 def produce worker = Delayed::Worker.new() worker.name = "rand #{Time.now.utc.to_f} #{rand(1000)}" if job = Delayed::Job.reserve(worker) logger.info("#{self.name} producing trooper to run #{job.queue} job #{job.id}") DelayedJobTrooper.new(job) end end |