beanstalk-client 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/lib/beanstalk-client/connection.rb +21 -1
- data/lib/beanstalk-client/version.rb +1 -1
- data/website/index.html +1 -1
- metadata +2 -2
data/History.txt
CHANGED
@@ -29,6 +29,10 @@ module Beanstalk
|
|
29
29
|
def initialize(addr, jptr=self)
|
30
30
|
@addr = addr
|
31
31
|
@jptr = jptr
|
32
|
+
connect
|
33
|
+
end
|
34
|
+
|
35
|
+
def connect
|
32
36
|
host, port = addr.split(':')
|
33
37
|
@socket = TCPSocket.new(host, port.to_i)
|
34
38
|
|
@@ -36,6 +40,11 @@ module Beanstalk
|
|
36
40
|
@socket.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
37
41
|
end
|
38
42
|
|
43
|
+
def close
|
44
|
+
@socket.close
|
45
|
+
@socket = nil
|
46
|
+
end
|
47
|
+
|
39
48
|
def put(body, pri=65536, delay=0, ttr=120)
|
40
49
|
@socket.write("put #{pri} #{delay} #{ttr} #{body.size}\r\n#{body}\r\n")
|
41
50
|
check_resp('INSERTED', 'BURIED')[0].to_i
|
@@ -217,8 +226,12 @@ module Beanstalk
|
|
217
226
|
@connections.values()
|
218
227
|
end
|
219
228
|
|
229
|
+
def last_server
|
230
|
+
@last_conn.addr
|
231
|
+
end
|
232
|
+
|
220
233
|
def send_to_conn(sel, *args)
|
221
|
-
pick_connection.send(sel, *args)
|
234
|
+
(@last_conn = pick_connection).send(sel, *args)
|
222
235
|
rescue DrainingError
|
223
236
|
# Don't reconnect -- we're not interested in this server
|
224
237
|
retry
|
@@ -251,6 +264,13 @@ module Beanstalk
|
|
251
264
|
@connections.delete(conn.addr)
|
252
265
|
end
|
253
266
|
|
267
|
+
def close
|
268
|
+
while @connections.size > 0
|
269
|
+
addr, conn = @connections.pop
|
270
|
+
conn.close
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
254
274
|
def peek()
|
255
275
|
open_connections.each do |c|
|
256
276
|
job = c.peek
|
data/website/index.html
CHANGED
@@ -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">0.
|
36
|
+
<a href="http://rubyforge.org/projects/beanstalk" class="numbers">0.7.0</a>
|
37
37
|
</div>
|
38
38
|
<h1>→ ‘beanstalk-client’</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: 0.
|
7
|
-
date: 2008-01
|
6
|
+
version: 0.7.0
|
7
|
+
date: 2008-02-01 00:00:00 -08:00
|
8
8
|
summary: Ruby client library for the Beanstalk protocol
|
9
9
|
require_paths:
|
10
10
|
- lib
|