summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/custodian/queue.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/custodian/queue.rb b/lib/custodian/queue.rb
index c48bba3..1ef9c61 100644
--- a/lib/custodian/queue.rb
+++ b/lib/custodian/queue.rb
@@ -58,6 +58,7 @@ module Custodian
raise "Subclasses must implement this method!"
end
+
#
# Empty the queue
#
@@ -102,6 +103,7 @@ end
end
end
+
#
# Add a new job to the queue.
#
@@ -117,6 +119,10 @@ end
@redis.llen( "queue" )
end
+
+ #
+ # Empty the queue, discarding all pending jobs.
+ #
def flush!
@redis.del( "queue" )
end
@@ -138,6 +144,7 @@ end
@queue = Beanstalk::Pool.new( ["#{host}:11300" ] )
end
+
#
# Here we fetch a value from the queue, and delete it at the same time.
#
@@ -175,8 +182,9 @@ end
( stats['current-jobs-ready'] || 0 )
end
+
#
- # Flush the queue.
+ # Flush the queue, discarding all pending jobs.
#
def flush!
while( fetch(1) )