lib/bluth/worker.rb in bluth-0.6.7 vs lib/bluth/worker.rb in bluth-0.6.8
- old
+ new
@@ -169,11 +169,11 @@
self.class.runblock :onstart
Familia.info "Setting interval: #{Worker.interval} sec (queuetimeout: #{Bluth.queuetimeout})"
Familia.reconnect_all! # Need to reconnect after daemonize
save
scheduler.every Worker.interval, :blocking => true do |task|
- Familia.ld "#{$$} TICK @ #{Time.now.utc}"
+ Familia.ld "#{$$} TICK @ #{Time.now.utc}" if Familia.debug?
sleep rand
find_gob task
end
scheduler.join
@@ -215,11 +215,11 @@
job.stime = Time.now.utc.to_i
self.working! job.jobid
tms = Benchmark.measure do
job.perform
end
- job.cpu = [tms.utime.fineround(3),tms.stime.fineround(3),tms.real.fineround(3)]
+ job.cpu = [tms.utime,tms.stime,tms.real]
job.save
job.success!
self.success!
end
end
@@ -301,10 +301,10 @@
self.class.runblock :onstart
save # persist and make note the scheduler is running
ScheduleWorker.schedule = Rufus::Scheduler::EmScheduler.start_new
self.class.every.each do |args|
interval, opts, blk = *args
- Familia.ld " scheduling every #{interval}: #{opts}"
+ Familia.ld " scheduling every #{interval}: #{opts}" if Familia.debug?
ScheduleWorker.schedule.every interval, opts, &blk
end
}
rescue => ex
msg = "#{ex.class}: #{ex.message}"