beanstalk-client 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,15 @@
1
+ == 1.0.2 2008-06-18
2
+
3
+ * Support reserve-with-timeout on pools. (Dustin Sallings)
4
+
5
+ == 1.0.1 (never released)
6
+
7
+ * Fix bug preventing jobs from being deleted.
8
+ * Remove an extraneous message. (Dustin Sallings)
9
+ * Fix the github gemspec so beanstalk-client builds. (Isaac Feliu)
10
+ * Support the new reserve-with-timeout command in dev beanstalkd.
11
+ (Dustin Sallings)
12
+
1
13
  == 1.0.0 2008-05-29
2
14
 
3
15
  * Preserve the watch list when a Pool instance reconnects.
@@ -26,10 +26,9 @@ module Beanstalk
26
26
  class Connection
27
27
  attr_reader :addr
28
28
 
29
- def initialize(addr, jptr=self, default_tube=nil)
29
+ def initialize(addr, default_tube=nil)
30
30
  @waiting = false
31
31
  @addr = addr
32
- @jptr = jptr
33
32
  connect
34
33
  @last_used = 'default'
35
34
  @watch_list = [@last_used]
@@ -75,9 +74,13 @@ module Beanstalk
75
74
  interact("peek-buried\r\n", :job)
76
75
  end
77
76
 
78
- def reserve()
77
+ def reserve(timeout=nil)
79
78
  raise WaitingForJobError if @waiting
80
- @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
81
84
 
82
85
  begin
83
86
  @waiting = true
@@ -89,7 +92,7 @@ module Beanstalk
89
92
  @waiting = false
90
93
  end
91
94
 
92
- Job.new(@jptr, *read_job('RESERVED'))
95
+ Job.new(self, *read_job('RESERVED'))
93
96
  end
94
97
 
95
98
  def delete(id)
@@ -181,7 +184,7 @@ module Beanstalk
181
184
  end
182
185
 
183
186
  def found_job()
184
- Job.new(@jptr, *read_job('FOUND'))
187
+ Job.new(self, *read_job('FOUND'))
185
188
  rescue NotFoundError
186
189
  nil
187
190
  end
@@ -224,8 +227,7 @@ module Beanstalk
224
227
  @addrs.each do |addr|
225
228
  begin
226
229
  if !@connections.include?(addr)
227
- puts "connecting to beanstalk at #{addr}"
228
- @connections[addr] = Connection.new(addr, self, @default_tube)
230
+ @connections[addr] = Connection.new(addr, @default_tube)
229
231
  prev_watched = @connections[addr].list_tubes_watched()
230
232
  to_ignore = prev_watched - @watch_list
231
233
  @watch_list.each{|tube| @connections[addr].watch(tube)}
@@ -255,8 +257,8 @@ module Beanstalk
255
257
  send_to_rand_conn(:yput, obj, pri, delay, ttr)
256
258
  end
257
259
 
258
- def reserve()
259
- send_to_rand_conn(:reserve)
260
+ def reserve(timeout=nil)
261
+ send_to_rand_conn(:reserve, timeout)
260
262
  end
261
263
 
262
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
 
@@ -1,5 +1,5 @@
1
1
  module Beanstalk #:nodoc:
2
2
  module VERSION #:nodoc:
3
- STRING = '1.0.0'
3
+ STRING = '1.0.2'
4
4
  end
5
5
  end
@@ -33,7 +33,7 @@
33
33
  <h1>Beanstalk Client</h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/beanstalk"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/beanstalk" class="numbers">1.0.0</a>
36
+ <a href="http://rubyforge.org/projects/beanstalk" class="numbers">1.0.2</a>
37
37
  </div>
38
38
  <h1>&#x2192; &#8216;beanstalk-client&#8217;</h1>
39
39
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: beanstalk-client
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.0
7
- date: 2008-05-29 00:00:00 -07:00
6
+ version: 1.0.2
7
+ date: 2008-06-18 00:00:00 -07:00
8
8
  summary: Ruby client library for the Beanstalk protocol
9
9
  require_paths:
10
10
  - lib