GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Fork of dustin/beanstalk-client-ruby
Description: Ruby client for beanstalkd
Homepage: http://xph.us/software/beanstalkd/
Clone URL: git://github.com/kr/beanstalk-client-ruby.git
Support reserve-with-timeout.
dustin (author)
Thu Jun 05 23:45:32 -0700 2008
commit  a5b81886084d57b6b82eacf5f64add79a0507e18
tree    6916206f83954585fbd7be983a6ab5390262ec66
parent  a261fb4ac6571215e9dcb0bc595a53b83d7835a9
...
74
75
76
77
 
78
79
 
 
 
 
 
80
81
82
...
74
75
76
 
77
78
 
79
80
81
82
83
84
85
86
0
@@ -74,9 +74,13 @@ module Beanstalk
0
       interact("peek-buried\r\n", :job)
0
     end
0
 
0
- def reserve()
0
+ def reserve(timeout=nil)
0
       raise WaitingForJobError if @waiting
0
- @socket.write("reserve\r\n")
0
+ if timeout.nil?
0
+ @socket.write("reserve\r\n")
0
+ else
0
+ @socket.write("reserve-with-timeout #{timeout}\r\n")
0
+ end
0
 
0
       begin
0
         @waiting = true
...
76
77
78
 
 
 
 
79
80
81
...
76
77
78
79
80
81
82
83
84
85
0
@@ -76,6 +76,10 @@ module Beanstalk
0
     WORD = 'JOB_TOO_BIG'
0
   end
0
 
0
+ class TimedOut < UnexpectedResponse
0
+ WORD = 'TIMED_OUT'
0
+ end
0
+
0
   class WaitingForJobError < RuntimeError
0
   end
0
 

Comments

    No one has commented yet.