summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rwxr-xr-xutil/empty-queue18
1 files changed, 14 insertions, 4 deletions
diff --git a/util/empty-queue b/util/empty-queue
index 3e5795b..5f84d53 100755
--- a/util/empty-queue
+++ b/util/empty-queue
@@ -1,18 +1,28 @@
#!/usr/bin/ruby
+#
+# Empty the beanstalk-queue.
+#
+# This is useful if you're aborting runs, or messing with the parser.
+#
+# Steve
+# --
+#
+
-require 'beanstalk-client'
+require 'beanstalk-client'
beanstalk = Beanstalk::Pool.new(['localhost:11300'])
#
-# Run until we're killed
+# Run until we receive a timeout-error - because retrieval of jobs failed.
#
while(true)
begin
- puts "\n\nWaiting for job.."
+ puts "\nWaiting for job.."
job = beanstalk.reserve(1)
- puts "Job acquired: #{Time.new.inspect}"
+ id = job.id
+ puts "\tDeleted job #{id}"
job.delete
rescue Beanstalk::TimedOut => ex
puts "Queue is empty"