From b066ad9584725301ee5c9e83b9672de9e4e83ef4 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Mon, 12 Nov 2012 21:07:09 +0000 Subject: Updated to be more descriptive in the output --- util/empty-queue | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'util/empty-queue') diff --git a/util/empty-queue b/util/empty-queue index 3e5795b..5f84d53 100755 --- a/util/empty-queue +++ b/util/empty-queue @@ -1,18 +1,28 @@ #!/usr/bin/ruby +# +# Empty the beanstalk-queue. +# +# This is useful if you're aborting runs, or messing with the parser. +# +# Steve +# -- +# + -require 'beanstalk-client' +require 'beanstalk-client' beanstalk = Beanstalk::Pool.new(['localhost:11300']) # -# Run until we're killed +# Run until we receive a timeout-error - because retrieval of jobs failed. # while(true) begin - puts "\n\nWaiting for job.." + puts "\nWaiting for job.." job = beanstalk.reserve(1) - puts "Job acquired: #{Time.new.inspect}" + id = job.id + puts "\tDeleted job #{id}" job.delete rescue Beanstalk::TimedOut => ex puts "Queue is empty" -- cgit v1.2.1