(Not documented)
# File vendor/plugins/ubiquo_jobs/lib/ubiquo_worker/worker.rb, line 6
6: def initialize(name, options = {})
7: raise ArgumentError, "A worker name is required" if name.blank?
8: self.name = name
9: self.sleep_time = options[:sleep_time]
10: self.shutdown = false
11: end
This method will start executing the planified jobs. If no job is available, the worker will sleep for sleep_time sec.
# File vendor/plugins/ubiquo_jobs/lib/ubiquo_worker/worker.rb, line 15
15: def run!
16: while (!shutdown) do
17: job = UbiquoJobs.manager.get(name)
18: if job
19: puts "#{Time.now} [#{name}] - executing job #{job.id}"
20: job.run!
21: else
22: puts "#{Time.now} [#{name}] - no job available"
23: sleep self.sleep_time
24: end
25: end
26: end
Disabled; run with $DEBUG to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.