vendor/bundle/ruby/1.8/gems/servolux-0.10.0/examples/beanstalk.rb
def execute
    @job = nil
    @job = @beanstalk.reserve(120) rescue nil
    if @job
      $stdout.puts "[C] #{Process.pid} processing job #{@job.inspect}"
      # ... do more processing here
    end
  rescue Beanstalk::TimedOut
  ensure
    @job.delete rescue nil if @job
  end
# Reserve a job from the beanstalk queue, and processes jobs as we receive
# them. We have a timeout set for 2 minutes so that we can send a heartbeat
# back to the parent process even if the beanstalk queue is empty.
#
# This method is called repeatedly by the child run loop until the child is
# killed via SIGHUP or SIGTERM or halted by the parent.
Reserve a job from the beanstalk queue, and processes jobs as we receive
them. We have a timeout set for 2 minutes so that we can send a heartbeat
back to the parent process even if the beanstalk queue is empty.

This method is called repeatedly by the child run loop until the child is
killed via SIGHUP or SIGTERM or halted by the parent.
Reserve a job from the beanstalk queue and processes jobs as we receive them . We have a timeout set for 2 minutes so that we can send a heartbeat back to the parent process even if the beanstalk queue is empty . This method is called repeatedly by the child run loop until the child is killed via SIGHUP or SIGTERM or halted by the parent .
def execute
    @job = nil
    @job = @beanstalk.reserve(120) rescue nil
    if @job
      $stdout.puts "[C] #{Process.pid} processing job #{@job.inspect}"
    end
  rescue Beanstalk::TimedOut
  ensure
    @job.delete rescue nil if @job
  end
def execute @job = nil @job = @beanstalk . reserve ( 120 ) rescue nil if @job $stdout . puts "[C] #{Process.pid} processing job #{@job.inspect}" end rescue Beanstalk :: TimedOut ensure @job . delete rescue nil if @job end
Reserve a job from the beanstalk queue, and processes jobs as we receive
them.
Reserve a job from the beanstalk queue and processes jobs as we receive them .
# ... do more processing here