summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-11-26 09:23:12 +0000
committerSteve Kemp <steve@steve.org.uk>2012-11-26 09:23:12 +0000
commit1bc00fe308b4d6de3faddb1bfc1e7529f3ba6f40 (patch)
tree9a986f0df5f7c8055953060ab85aba775174d6c6 /bin
parent839a27363fbb58556ee04347568d7d219e03e07f (diff)
Explicitly watch a "tube" - a named queue - to avoid stomping on
anything else running under beanstalkd.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/custodian-enqueue2
-rwxr-xr-xbin/custodian-queue7
2 files changed, 6 insertions, 3 deletions
diff --git a/bin/custodian-enqueue b/bin/custodian-enqueue
index 34e225a..9e8e9a3 100755
--- a/bin/custodian-enqueue
+++ b/bin/custodian-enqueue
@@ -139,7 +139,7 @@ if __FILE__ == $0 then
#
# Connected to the server
#
- queue = Beanstalk::Pool.new([$SERVER])
+ queue = Beanstalk::Pool.new([$SERVER], "Custodian")
if ( ! queue )
puts "Failed to connect to beanstalk server: #{$SERVER}"
exit 1
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