kr-beanstalk-client 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -74,9 +74,13 @@ module Beanstalk
74
74
  interact("peek-buried\r\n", :job)
75
75
  end
76
76
 
77
- def reserve()
77
+ def reserve(timeout=nil)
78
78
  raise WaitingForJobError if @waiting
79
- @socket.write("reserve\r\n")
79
+ if timeout.nil?
80
+ @socket.write("reserve\r\n")
81
+ else
82
+ @socket.write("reserve-with-timeout #{timeout}\r\n")
83
+ end
80
84
 
81
85
  begin
82
86
  @waiting = true
@@ -253,8 +257,8 @@ module Beanstalk
253
257
  send_to_rand_conn(:yput, obj, pri, delay, ttr)
254
258
  end
255
259
 
256
- def reserve()
257
- send_to_rand_conn(:reserve)
260
+ def reserve(timeout=nil)
261
+ send_to_rand_conn(:reserve, timeout)
258
262
  end
259
263
 
260
264
  def use(tube)
@@ -76,6 +76,10 @@ module Beanstalk
76
76
  WORD = 'JOB_TOO_BIG'
77
77
  end
78
78
 
79
+ class TimedOut < UnexpectedResponse
80
+ WORD = 'TIMED_OUT'
81
+ end
82
+
79
83
  class WaitingForJobError < RuntimeError
80
84
  end
81
85
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kr-beanstalk-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Rarick