From 1bc00fe308b4d6de3faddb1bfc1e7529f3ba6f40 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Mon, 26 Nov 2012 09:23:12 +0000 Subject: Explicitly watch a "tube" - a named queue - to avoid stomping on anything else running under beanstalkd. --- bin/custodian-queue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bin/custodian-queue') diff --git a/bin/custodian-queue b/bin/custodian-queue index cb4c3ce..6298f88 100755 --- a/bin/custodian-queue +++ b/bin/custodian-queue @@ -129,9 +129,9 @@ if __FILE__ == $0 then end # - # Create the object + # Create the queue object. # - queue = Beanstalk::Pool.new([$SERVER]) + queue = Beanstalk::Pool.new([$SERVER], "Custodian" ) # # Alerting on a queue that is too-full? @@ -169,11 +169,14 @@ if __FILE__ == $0 then # Are we flushing the queue? # if ( $FLUSH ) + count = 0 while( true ) begin job = queue.reserve(1) job.delete + count += 1 rescue Beanstalk::TimedOut => ex + puts "Flushed #{count} pending jobs." exit( 0 ) end end -- cgit v1.2.1