summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/custodian/custodian.cfg8
-rw-r--r--lib/custodian/queue.rb14
-rw-r--r--lib/custodian/settings.rb13
3 files changed, 11 insertions, 24 deletions
diff --git a/etc/custodian/custodian.cfg b/etc/custodian/custodian.cfg
index a004979..e202f9a 100644
--- a/etc/custodian/custodian.cfg
+++ b/etc/custodian/custodian.cfg
@@ -5,14 +5,6 @@
#
-
-##
-# The address of the queue to connect to.
-#
-# queue_server = 127.0.0.1:11300
-##
-
-
##
# The type of queue to use: "redis" or "beanstalkd".
#
diff --git a/lib/custodian/queue.rb b/lib/custodian/queue.rb
index d3513c3..67c5346 100644
--- a/lib/custodian/queue.rb
+++ b/lib/custodian/queue.rb
@@ -76,10 +76,10 @@ end
#
- # Connect to the server on localhost
+ # Connect to the server on localhost, unless QUEUE_ADDRESS is set.
#
def initialize
- host = ENV["REDIS"] || "127.0.0.1"
+ host = ENV["QUEUE_ADDRESS"] || "127.0.0.1"
@redis = Redis.new( :host => host )
end
@@ -124,11 +124,11 @@ end
class BeanstalkQueueType < QueueType
#
- # Connect to the server on localhost
+ # Connect to the server on localhost, unless QUEUE_ADDRESS is set.
#
def initialize
- host = ENV["QUEUE"] || "127.0.0.1:11300"
- @queue = Beanstalk::Pool.new([host] )
+ host = ENV["QUEUE_ADDRESS"] || "127.0.0.1"
+ @queue = Beanstalk::Pool.new( ["#{host}:11300" ] )
end
#
@@ -168,8 +168,10 @@ end
( stats['current-jobs-ready'] || 0 )
end
+ #
+ # Flush the queue.
+ #
def flush!
-
while( fetch(1) )
# nop
end
diff --git a/lib/custodian/settings.rb b/lib/custodian/settings.rb
index 897c099..bef2977 100644
--- a/lib/custodian/settings.rb
+++ b/lib/custodian/settings.rb
@@ -140,18 +140,11 @@ module Custodian
#
- # The address of the queue.
- #
- def queue_server
- _load() unless( _loaded? )
-
- @settings['queue_server'] || "127.0.0.1:11300"
- end
-
-
- #
# The type of queue to use.
#
+ # The hostname/IP address of the queue should be set in the
+ # environmental variable 'QUEUE_ADDRESS'.
+ #
def queue_type
_load() unless( _loaded? )