diff options
author | Steve Kemp <steve@steve.org.uk> | 2012-11-12 21:00:16 +0000 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2012-11-12 21:00:16 +0000 |
commit | 6334b9cdfc47bd85b2ce236572e08406324d25cd (patch) | |
tree | bd0bd3cc279d8377efde2affc8dc223bfb858ca2 /util/empty-queue |
Initial dump of code.
Diffstat (limited to 'util/empty-queue')
-rwxr-xr-x | util/empty-queue | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/util/empty-queue b/util/empty-queue new file mode 100755 index 0000000..3e5795b --- /dev/null +++ b/util/empty-queue @@ -0,0 +1,23 @@ +#!/usr/bin/ruby + +require 'beanstalk-client' + + +beanstalk = Beanstalk::Pool.new(['localhost:11300']) + +# +# Run until we're killed +# +while(true) + begin + puts "\n\nWaiting for job.." + job = beanstalk.reserve(1) + puts "Job acquired: #{Time.new.inspect}" + job.delete + rescue Beanstalk::TimedOut => ex + puts "Queue is empty" + exit(0) + end +end + + |