blob: 5f84d53fd958f468dcfe22fba6b802cb1917d58c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/usr/bin/ruby
#
# Empty the beanstalk-queue.
#
# This is useful if you're aborting runs, or messing with the parser.
#
# Steve
# --
#
require 'beanstalk-client'
beanstalk = Beanstalk::Pool.new(['localhost:11300'])
#
# Run until we receive a timeout-error - because retrieval of jobs failed.
#
while(true)
begin
puts "\nWaiting for job.."
job = beanstalk.reserve(1)
id = job.id
puts "\tDeleted job #{id}"
job.delete
rescue Beanstalk::TimedOut => ex
puts "Queue is empty"
exit(0)
end
end
|