summaryrefslogtreecommitdiff
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
commit06022289eb29ae3475030d3fd5fd478839bbdc60 (patch)
tree8787a0ec70361ca17cdabfd5b36c8cda2ea2c5c8
parent00debd01a50ccde37a45f83940f3b07e4bee3155 (diff)
Explicitly watch a "tube" - a named queue - to avoid stomping on
anything else running under beanstalkd.
-rwxr-xr-xbin/custodian-enqueue2
-rwxr-xr-xbin/custodian-queue7
-rw-r--r--debian/changelog7
-rw-r--r--lib/custodian/worker.rb2
4 files changed, 14 insertions, 4 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
diff --git a/debian/changelog b/debian/changelog
index 7021fed..68a56f6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+custodian (0.2-2) stable; urgency=low
+
+ * Explicitly setup a "tube", which is a named queue.
+ This means we'll never stomp over the default queue
+
+ -- Steve Kemp <steve@bytemark.co.uk> Sun, 25 Nov 2012 23:44:32 +0000
+
custodian (0.2-1) stable; urgency=low
* Updated to use the user-specified text on test-failure.
diff --git a/lib/custodian/worker.rb b/lib/custodian/worker.rb
index 56dcbed..bdafb9d 100644
--- a/lib/custodian/worker.rb
+++ b/lib/custodian/worker.rb
@@ -69,7 +69,7 @@ module Custodian
def initialize( server, alerter, logfile )
# Connect to the queue
- @queue = Beanstalk::Pool.new([server])
+ @queue = Beanstalk::Pool.new([server], "Custodian" )
# Get the alerter-type to instantiate
@alerter = alerter