From 6334b9cdfc47bd85b2ce236572e08406324d25cd Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Mon, 12 Nov 2012 21:00:16 +0000 Subject: Initial dump of code. --- util/empty-queue | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 util/empty-queue (limited to 'util/empty-queue') diff --git a/util/empty-queue b/util/empty-queue new file mode 100755 index 0000000..3e5795b --- /dev/null +++ b/util/empty-queue @@ -0,0 +1,23 @@ +#!/usr/bin/ruby + +require 'beanstalk-client' + + +beanstalk = Beanstalk::Pool.new(['localhost:11300']) + +# +# Run until we're killed +# +while(true) + begin + puts "\n\nWaiting for job.." + job = beanstalk.reserve(1) + puts "Job acquired: #{Time.new.inspect}" + job.delete + rescue Beanstalk::TimedOut => ex + puts "Queue is empty" + exit(0) + end +end + + -- cgit v1.2.1