net-http-persistent 4.0.1 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +6 -7
- data/History.txt +6 -0
- data/Manifest.txt +0 -1
- data/README.rdoc +1 -1
- data/Rakefile +20 -26
- data/lib/net/http/persistent/connection.rb +1 -0
- data/lib/net/http/persistent/pool.rb +21 -9
- data/lib/net/http/persistent.rb +10 -3
- data/test/test_net_http_persistent.rb +18 -1
- data/test/test_net_http_persistent_timed_stack_multi.rb +1 -1
- metadata +7 -90
- data/.travis.yml +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9123e98741595dbcc1c9a9713ecdcfb517597dc52791dc546bd868c31cbe88d0
|
4
|
+
data.tar.gz: 462f4ae1dd63c8776ac18e3eab2b8e4c43e65d906722086a670d5ae3b764eb2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45e3ea77d23e8c9829bba490c61546b71a221194cf8106bbb32ad746408283df04923649aef952d7317f06475a0a5466b19376c7a38e8b62490d65f24b6031cf
|
7
|
+
data.tar.gz: e46564075c2d655e258c5fd9ff3c45843b48c5bd6d8c5f80fe84450a36e7ac5811d0f97b5e8223277c2b607e7259df70e1e331c372e12a4bd33efec0e555e743
|
data/Gemfile
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
|
3
|
-
# DO NOT EDIT THIS FILE. Instead, edit Rakefile, and run `rake bundler:gemfile`.
|
4
|
-
|
5
3
|
source "https://rubygems.org/"
|
6
4
|
|
7
|
-
|
5
|
+
gemspec
|
8
6
|
|
9
|
-
gem "
|
10
|
-
gem "
|
11
|
-
gem "hoe-travis", "~>1.4", ">=1.4.1", :group => [:development, :test]
|
7
|
+
gem "rake", "~>13.0"
|
8
|
+
gem "minitest", "~>5.15", :group => [:development, :test]
|
12
9
|
gem "rdoc", ">=4.0", "<7", :group => [:development, :test]
|
13
|
-
gem "
|
10
|
+
gem "rake-manifest", "~>0.2"
|
11
|
+
|
12
|
+
gem 'net-http-pipeline', '~> 1.0' if ENV['CI_MATRIX'] == 'pipeline'
|
14
13
|
|
15
14
|
# vim: syntax=ruby
|
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -1,31 +1,25 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
|
3
|
-
require
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
dependency 'connection_pool', '~> 2.2'
|
24
|
-
dependency 'minitest', '~> 5.2', :development
|
25
|
-
dependency 'hoe-bundler', '~> 1.5', :development
|
26
|
-
dependency 'hoe-travis', ['~> 1.4', '>= 1.4.1'], :development
|
27
|
-
dependency 'net-http-pipeline', '~> 1.0' if
|
28
|
-
ENV['TRAVIS_MATRIX'] == 'pipeline'
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
|
5
|
+
require "rake/testtask"
|
6
|
+
|
7
|
+
Rake::TestTask.new
|
8
|
+
|
9
|
+
require "rake/manifest"
|
10
|
+
|
11
|
+
Rake::Manifest::Task.new do |t|
|
12
|
+
t.patterns = [
|
13
|
+
".autotest",
|
14
|
+
".gemtest",
|
15
|
+
".travis.yml",
|
16
|
+
"Gemfile",
|
17
|
+
"History.txt",
|
18
|
+
"Manifest.txt",
|
19
|
+
"README.rdoc",
|
20
|
+
"Rakefile",
|
21
|
+
"{test,lib}/**/*"
|
22
|
+
]
|
29
23
|
end
|
30
24
|
|
31
25
|
# vim: syntax=Ruby
|
@@ -11,20 +11,32 @@ class Net::HTTP::Persistent::Pool < ConnectionPool # :nodoc:
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def checkin net_http_args
|
14
|
-
|
14
|
+
if net_http_args.is_a?(Hash) && net_http_args.size == 1 && net_http_args[:force]
|
15
|
+
# ConnectionPool 2.4+ calls `checkin(force: true)` after fork.
|
16
|
+
# When this happens, we should remove all connections from Thread.current
|
17
|
+
if stacks = Thread.current[@key]
|
18
|
+
stacks.each do |http_args, connections|
|
19
|
+
connections.each do |conn|
|
20
|
+
@available.push conn, connection_args: http_args
|
21
|
+
end
|
22
|
+
connections.clear
|
23
|
+
end
|
24
|
+
end
|
25
|
+
else
|
26
|
+
stack = Thread.current[@key][net_http_args] ||= []
|
15
27
|
|
16
|
-
|
17
|
-
|
28
|
+
raise ConnectionPool::Error, 'no connections are checked out' if
|
29
|
+
stack.empty?
|
18
30
|
|
19
|
-
|
31
|
+
conn = stack.pop
|
20
32
|
|
21
|
-
|
22
|
-
|
33
|
+
if stack.empty?
|
34
|
+
@available.push conn, connection_args: net_http_args
|
23
35
|
|
24
|
-
|
25
|
-
|
36
|
+
Thread.current[@key].delete(net_http_args)
|
37
|
+
Thread.current[@key] = nil if Thread.current[@key].empty?
|
38
|
+
end
|
26
39
|
end
|
27
|
-
|
28
40
|
nil
|
29
41
|
end
|
30
42
|
|
data/lib/net/http/persistent.rb
CHANGED
@@ -164,7 +164,14 @@ class Net::HTTP::Persistent
|
|
164
164
|
# limits (typically windows).
|
165
165
|
|
166
166
|
if Process.const_defined? :RLIMIT_NOFILE
|
167
|
-
|
167
|
+
open_file_limits = Process.getrlimit(Process::RLIMIT_NOFILE)
|
168
|
+
|
169
|
+
# Under JRuby on Windows Process responds to `getrlimit` but returns something that does not match docs
|
170
|
+
if open_file_limits.respond_to?(:first)
|
171
|
+
DEFAULT_POOL_SIZE = open_file_limits.first / 4
|
172
|
+
else
|
173
|
+
DEFAULT_POOL_SIZE = 256
|
174
|
+
end
|
168
175
|
else
|
169
176
|
DEFAULT_POOL_SIZE = 256
|
170
177
|
end
|
@@ -172,7 +179,7 @@ class Net::HTTP::Persistent
|
|
172
179
|
##
|
173
180
|
# The version of Net::HTTP::Persistent you are using
|
174
181
|
|
175
|
-
VERSION = '4.0.
|
182
|
+
VERSION = '4.0.2'
|
176
183
|
|
177
184
|
##
|
178
185
|
# Error class for errors raised by Net::HTTP::Persistent. Various
|
@@ -710,7 +717,7 @@ class Net::HTTP::Persistent
|
|
710
717
|
# block is given. Returns all responses received.
|
711
718
|
#
|
712
719
|
# See
|
713
|
-
# Net::HTTP::Pipeline[
|
720
|
+
# Net::HTTP::Pipeline[https://rdoc.info/gems/net-http-pipeline/Net/HTTP/Pipeline]
|
714
721
|
# for further details.
|
715
722
|
#
|
716
723
|
# Only if <tt>net-http-pipeline</tt> was required before
|
@@ -362,6 +362,7 @@ class TestNetHttpPersistent < Minitest::Test
|
|
362
362
|
end
|
363
363
|
|
364
364
|
def test_connection_for_finished_ssl
|
365
|
+
skip 'Broken on Windows' if Gem.win_platform?
|
365
366
|
skip 'OpenSSL is missing' unless HAVE_OPENSSL
|
366
367
|
|
367
368
|
uri = URI.parse 'https://example.com/path'
|
@@ -555,6 +556,7 @@ class TestNetHttpPersistent < Minitest::Test
|
|
555
556
|
end
|
556
557
|
|
557
558
|
def test_connection_for_ssl
|
559
|
+
skip 'Broken on Windows' if Gem.win_platform?
|
558
560
|
skip 'OpenSSL is missing' unless HAVE_OPENSSL
|
559
561
|
|
560
562
|
uri = URI.parse 'https://example.com/path'
|
@@ -595,6 +597,7 @@ class TestNetHttpPersistent < Minitest::Test
|
|
595
597
|
end
|
596
598
|
|
597
599
|
def test_connection_for_ssl_case
|
600
|
+
skip 'Broken on Windows' if Gem.win_platform?
|
598
601
|
skip 'OpenSSL is missing' unless HAVE_OPENSSL
|
599
602
|
|
600
603
|
uri = URI.parse 'HTTPS://example.com/path'
|
@@ -631,6 +634,7 @@ class TestNetHttpPersistent < Minitest::Test
|
|
631
634
|
end
|
632
635
|
|
633
636
|
def test_expired_eh
|
637
|
+
skip 'Broken on Windows' if Gem.win_platform?
|
634
638
|
c = basic_connection
|
635
639
|
c.requests = 0
|
636
640
|
c.last_use = Time.now - 11
|
@@ -976,7 +980,10 @@ class TestNetHttpPersistent < Minitest::Test
|
|
976
980
|
assert_equal 'keep-alive', req['connection']
|
977
981
|
assert_equal '30', req['keep-alive']
|
978
982
|
|
979
|
-
|
983
|
+
# There's some roounding issue on jruby preventing this from passing
|
984
|
+
unless RUBY_PLATFORM == "java"
|
985
|
+
assert_in_delta Time.now, c.last_use
|
986
|
+
end
|
980
987
|
|
981
988
|
assert_equal 1, c.requests
|
982
989
|
end
|
@@ -1437,5 +1444,15 @@ class TestNetHttpPersistent < Minitest::Test
|
|
1437
1444
|
assert_equal 1, @http.ssl_generation
|
1438
1445
|
end
|
1439
1446
|
|
1447
|
+
def test_connection_pool_after_fork
|
1448
|
+
# ConnectionPool 2.4+ calls `checkin(force: true)` after fork
|
1449
|
+
@http.pool.checkin(force: true)
|
1450
|
+
|
1451
|
+
@http.pool.checkout ['example.com', 80, nil, nil, nil, nil]
|
1452
|
+
@http.pool.checkin(force: true)
|
1453
|
+
@http.pool.reload do |connection|
|
1454
|
+
connection.close
|
1455
|
+
end
|
1456
|
+
end
|
1440
1457
|
end
|
1441
1458
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-http-persistent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Hodel
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|
@@ -24,88 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.2'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: minitest
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '5.14'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '5.14'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: hoe-bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '1.5'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '1.5'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: hoe-travis
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.4'
|
62
|
-
- - ">="
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: 1.4.1
|
65
|
-
type: :development
|
66
|
-
prerelease: false
|
67
|
-
version_requirements: !ruby/object:Gem::Requirement
|
68
|
-
requirements:
|
69
|
-
- - "~>"
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
version: '1.4'
|
72
|
-
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: 1.4.1
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: rdoc
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - ">="
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '4.0'
|
82
|
-
- - "<"
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
version: '7'
|
85
|
-
type: :development
|
86
|
-
prerelease: false
|
87
|
-
version_requirements: !ruby/object:Gem::Requirement
|
88
|
-
requirements:
|
89
|
-
- - ">="
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version: '4.0'
|
92
|
-
- - "<"
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
version: '7'
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
|
-
name: hoe
|
97
|
-
requirement: !ruby/object:Gem::Requirement
|
98
|
-
requirements:
|
99
|
-
- - "~>"
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: '3.22'
|
102
|
-
type: :development
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
requirements:
|
106
|
-
- - "~>"
|
107
|
-
- !ruby/object:Gem::Version
|
108
|
-
version: '3.22'
|
109
27
|
description: |-
|
110
28
|
Manages persistent connections using Net::HTTP including a thread pool for
|
111
29
|
connecting to multiple hosts.
|
@@ -129,7 +47,6 @@ extra_rdoc_files:
|
|
129
47
|
files:
|
130
48
|
- ".autotest"
|
131
49
|
- ".gemtest"
|
132
|
-
- ".travis.yml"
|
133
50
|
- Gemfile
|
134
51
|
- History.txt
|
135
52
|
- Manifest.txt
|
@@ -146,7 +63,7 @@ licenses:
|
|
146
63
|
- MIT
|
147
64
|
metadata:
|
148
65
|
homepage_uri: https://github.com/drbrain/net-http-persistent
|
149
|
-
post_install_message:
|
66
|
+
post_install_message:
|
150
67
|
rdoc_options:
|
151
68
|
- "--main"
|
152
69
|
- README.rdoc
|
@@ -156,15 +73,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
73
|
requirements:
|
157
74
|
- - ">="
|
158
75
|
- !ruby/object:Gem::Version
|
159
|
-
version: '2.
|
76
|
+
version: '2.4'
|
160
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
78
|
requirements:
|
162
79
|
- - ">="
|
163
80
|
- !ruby/object:Gem::Version
|
164
81
|
version: '0'
|
165
82
|
requirements: []
|
166
|
-
rubygems_version: 3.1
|
167
|
-
signing_key:
|
83
|
+
rubygems_version: 3.0.3.1
|
84
|
+
signing_key:
|
168
85
|
specification_version: 4
|
169
86
|
summary: Manages persistent connections using Net::HTTP including a thread pool for
|
170
87
|
connecting to multiple hosts
|
data/.travis.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
---
|
2
|
-
after_script:
|
3
|
-
- rake travis:after -t
|
4
|
-
before_script:
|
5
|
-
- gem install hoe-travis --no-document
|
6
|
-
- rake travis:before -t
|
7
|
-
language: ruby
|
8
|
-
notifications:
|
9
|
-
email:
|
10
|
-
- drbrain@segment7.net
|
11
|
-
rvm:
|
12
|
-
- 2.3
|
13
|
-
- 2.4
|
14
|
-
- 2.5
|
15
|
-
- 2.6
|
16
|
-
- 2.7
|
17
|
-
script: rake travis
|
18
|
-
install: "" # avoid running default bundler install
|
19
|
-
|
20
|
-
matrix:
|
21
|
-
include:
|
22
|
-
- rvm: "2.7"
|
23
|
-
env: TRAVIS_MATRIX=pipeline
|