summaryrefslogtreecommitdiff
path: root/util/empty-queue
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-11-12 21:07:09 +0000
committerSteve Kemp <steve@steve.org.uk>2012-11-12 21:07:09 +0000
commitb066ad9584725301ee5c9e83b9672de9e4e83ef4 (patch)
treeed5b037e75b3fd98c593d224079968972645e62f /util/empty-queue
parentec3c426f81ec80e92bc06fc50fe52b77c22ebb3d (diff)
Updated to be more descriptive in the output
Diffstat (limited to 'util/empty-queue')
-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"