Method: Bluth::Gob#move!

Defined in:
lib/bluth.rb

#move!(to, msg = nil) ⇒ Object



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/bluth.rb', line 359

def move!(to, msg=nil)
  @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}" 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
  @current_queue = to.name
  save # update messages
end