lib/bluth.rb in bluth-0.6.7 vs lib/bluth.rb in bluth-0.6.8

- old
+ new

@@ -138,11 +138,11 @@ begin order = Bluth::Queue.entry_queues.collect(&:rediskey) order << Bluth.queuetimeout # We do it this way to support Ruby 1.8 queue, gobid = *(Bluth::Queue.redis.send(meth, *order) || []) unless queue.nil? - Familia.ld "FOUND #{gobid} id #{queue}" + Familia.ld "FOUND #{gobid} id #{queue}" if Familia.debug? gob = Gob.from_redis gobid raise Bluth::Buster, "No such gob object: #{gobid}" if gob.nil? Bluth::Queue.running << gob.jobid gob.current_queue = :running gob.save @@ -152,11 +152,11 @@ Familia.info "ERROR: #{ex.message}" else Familia.info "ERROR (#{ex.message}): #{gobid} is an orphan" Bluth::Queue.orphaned << gobid end - Familia.ld ex.backtrace + Familia.ld ex.backtrace if Familia.debug? end gob end end @@ -184,11 +184,11 @@ gob = Gob.create generate_id(data), self, data gob.current_queue = q.name gob.created gob.attempts = 0 gob.save - Familia.ld "ENQUEUING: #{self} #{gob.jobid.short} to #{q}" + Familia.ld "ENQUEUING: #{self} #{gob.jobid.short} to #{q}" if Familia.debug? q << gob.jobid gob end def queue(name=nil) @queue = name if name @@ -255,11 +255,11 @@ def handler eval "::#{@handler}" if @handler end def perform @attempts += 1 - Familia.ld "PERFORM: #{self.to_hash.inspect}" + Familia.ld "PERFORM: #{self.to_hash.inspect}" if Familia.debug? @stime = Time.now.utc.to_f save # update the time self.handler.prepare if self.class.respond_to?(:prepare) self.handler.perform @data @etime = Time.now.utc.to_f @@ -289,11 +289,11 @@ end def queue Bluth.queue(current_queue) end def dequeue! - Familia.ld "Deleting #{self.jobid} from #{queue.rediskey}" + Familia.ld "Deleting #{self.jobid} from #{queue.rediskey}" if Familia.debug? queue.remove 0, self.jobid end def running! move! :running end @@ -301,10 +301,10 @@ @thread_id = $$ #if to.to_s == current_queue.to_s # raise Bluth::Buster, "Cannot move job to the queue it's in: #{to}" #end from, to = Bluth.queue(current_queue), Bluth.queue(to) - Familia.ld "Moving #{self.jobid} from #{from.rediskey} to #{to.rediskey}" + Familia.ld "Moving #{self.jobid} from #{from.rediskey} to #{to.rediskey}" if Familia.debug? @messages << msg unless msg.nil? || msg.empty? # We push first to make sure we never lose a Gob ID. Instead # there's the small chance of a job ID being in two queues. to << @jobid ret = from.remove @jobid, 0