net-http-persistent 2.2 → 2.3
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +7 -1
- data/lib/net/http/persistent.rb +7 -4
- data/test/test_net_http_persistent.rb +4 -1
- metadata +3 -3
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,6 +1,12 @@
|
|
1
|
-
=== 2.
|
1
|
+
=== 2.3 / 2011-10-25
|
2
2
|
|
3
3
|
* Minor Enhancement
|
4
|
+
* The time since last use for a connection is now recorded in error
|
5
|
+
messages for the connection.
|
6
|
+
|
7
|
+
=== 2.2 / 2011-10-24
|
8
|
+
|
9
|
+
* Minor Enhancements
|
4
10
|
* Added timeouts for idle connections which are set through #idle_timeout.
|
5
11
|
The default timeout is 5 seconds. Reducing the idle timeout is preferred
|
6
12
|
over setting #retry_change_requests to true if you wish to avoid the "too
|
data/lib/net/http/persistent.rb
CHANGED
@@ -149,7 +149,7 @@ class Net::HTTP::Persistent
|
|
149
149
|
##
|
150
150
|
# The version of Net::HTTP::Persistent you are using
|
151
151
|
|
152
|
-
VERSION = '2.
|
152
|
+
VERSION = '2.3'
|
153
153
|
|
154
154
|
##
|
155
155
|
# Error class for errors raised by Net::HTTP::Persistent. Various
|
@@ -425,10 +425,13 @@ class Net::HTTP::Persistent
|
|
425
425
|
# this connection
|
426
426
|
|
427
427
|
def error_message connection
|
428
|
-
requests =
|
429
|
-
|
428
|
+
requests = Thread.current[@request_key][connection.object_id] - 1 # fixup
|
429
|
+
last_use = Thread.current[@timeout_key][connection.object_id]
|
430
430
|
|
431
|
-
|
431
|
+
age = Time.now - last_use
|
432
|
+
|
433
|
+
"after #{requests} requests on #{connection.object_id}, " \
|
434
|
+
"last used #{age} seconds ago"
|
432
435
|
end
|
433
436
|
|
434
437
|
##
|
@@ -348,9 +348,12 @@ class TestNetHttpPersistent < MiniTest::Unit::TestCase
|
|
348
348
|
|
349
349
|
def test_error_message
|
350
350
|
c = basic_connection
|
351
|
+
touts[c.object_id] = Time.now - 1
|
351
352
|
reqs[c.object_id] = 5
|
352
353
|
|
353
|
-
|
354
|
+
message = @http.error_message(c)
|
355
|
+
assert_match %r%after 4 requests on #{c.object_id}%, message
|
356
|
+
assert_match %r%, last used [\d.]+ seconds ago%, message
|
354
357
|
end
|
355
358
|
|
356
359
|
def test_escape
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|