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 CHANGED
Binary file
data/History.txt CHANGED
@@ -1,6 +1,12 @@
1
- === 2.2 / 2011-10-24
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
@@ -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.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
- Thread.current[@request_key][connection.object_id]
428
+ requests = Thread.current[@request_key][connection.object_id] - 1 # fixup
429
+ last_use = Thread.current[@timeout_key][connection.object_id]
430
430
 
431
- "after #{requests} requests on #{connection.object_id}"
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
- assert_equal "after 5 requests on #{c.object_id}", @http.error_message(c)
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
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-http-persistent
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
- - 2
9
- version: "2.2"
8
+ - 3
9
+ version: "2.3"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Eric Hodel
metadata.gz.sig CHANGED
Binary file