net-http-persistent 4.0.0 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33e30717daf3230e2432295be22f54e49cae5fda06ee56ccff86b97da785a842
4
- data.tar.gz: 903437046b46bf3c2b7381abe4ac8b45347ccc732095f620033d860abf48dbf6
3
+ metadata.gz: 9123e98741595dbcc1c9a9713ecdcfb517597dc52791dc546bd868c31cbe88d0
4
+ data.tar.gz: 462f4ae1dd63c8776ac18e3eab2b8e4c43e65d906722086a670d5ae3b764eb2b
5
5
  SHA512:
6
- metadata.gz: f578761fe5a7fb8a5fc7887a4cf798d7ba016bb8d471870d68f0ff6147904c10f9e2bb2f8456c7045a755c8e3168f43bd72cac204c935d2ba78dbc0172b21a17
7
- data.tar.gz: a01ef587f907aae73483401ed61a78f30e8ce0da3661a40a39b29924446107d13c3678792c62bc1d5c53196e85345c11728c714d703bfb281bf63c6d4bb14b7a
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
- gem "connection_pool", "~>2.2"
5
+ gemspec
8
6
 
9
- gem "minitest", "~>5.11", :group => [:development, :test]
10
- gem "hoe-bundler", "~>1.5", :group => [:development, :test]
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 "hoe", "~>3.17", :group => [:development, :test]
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
@@ -1,3 +1,15 @@
1
+ === 4.0.2 / 2023-03-29
2
+
3
+ Bug fixes:
4
+
5
+ * Fix compatibility with `connection_pool 2.4+`
6
+
7
+ === 4.0.1 / 2021-01-12
8
+
9
+ Bug fixes:
10
+
11
+ * Loosen Ruby version requirement so Ruby 3.0 will work.
12
+
1
13
  === 4.0.0 / 2020-04-30
2
14
 
3
15
  Breaking changes:
data/Manifest.txt CHANGED
@@ -1,6 +1,5 @@
1
1
  .autotest
2
2
  .gemtest
3
- .travis.yml
4
3
  Gemfile
5
4
  History.txt
6
5
  Manifest.txt
data/README.rdoc CHANGED
@@ -1,7 +1,7 @@
1
1
  = net-http-persistent
2
2
 
3
3
  home :: https://github.com/drbrain/net-http-persistent
4
- rdoc :: http://docs.seattlerb.org/net-http-persistent
4
+ rdoc :: https://rdoc.info/gems/net-http-persistent
5
5
 
6
6
  == DESCRIPTION:
7
7
 
data/Rakefile CHANGED
@@ -1,31 +1,25 @@
1
1
  # -*- ruby -*-
2
2
 
3
- require 'hoe'
4
-
5
- Hoe.plugin :bundler
6
- Hoe.plugin :git
7
- Hoe.plugin :minitest
8
- Hoe.plugin :travis
9
-
10
- Hoe.spec 'net-http-persistent' do
11
- developer 'Eric Hodel', 'drbrain@segment7.net'
12
-
13
- self.readme_file = 'README.rdoc'
14
- self.extra_rdoc_files += Dir['*.rdoc']
15
-
16
- self.require_ruby_version '~> 2.3'
17
-
18
- license 'MIT'
19
-
20
- rdoc_locations <<
21
- 'docs-push.seattlerb.org:/data/www/docs.seattlerb.org/net-http-persistent/'
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
@@ -25,6 +25,7 @@ class Net::HTTP::Persistent::Connection # :nodoc:
25
25
  ensure
26
26
  reset
27
27
  end
28
+ alias_method :close, :finish
28
29
 
29
30
  def reset
30
31
  @last_use = Net::HTTP::Persistent::EPOCH
@@ -11,20 +11,32 @@ class Net::HTTP::Persistent::Pool < ConnectionPool # :nodoc:
11
11
  end
12
12
 
13
13
  def checkin net_http_args
14
- stack = Thread.current[@key][net_http_args] ||= []
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
- raise ConnectionPool::Error, 'no connections are checked out' if
17
- stack.empty?
28
+ raise ConnectionPool::Error, 'no connections are checked out' if
29
+ stack.empty?
18
30
 
19
- conn = stack.pop
31
+ conn = stack.pop
20
32
 
21
- if stack.empty?
22
- @available.push conn, connection_args: net_http_args
33
+ if stack.empty?
34
+ @available.push conn, connection_args: net_http_args
23
35
 
24
- Thread.current[@key].delete(net_http_args)
25
- Thread.current[@key] = nil if Thread.current[@key].empty?
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
 
@@ -164,7 +164,14 @@ class Net::HTTP::Persistent
164
164
  # limits (typically windows).
165
165
 
166
166
  if Process.const_defined? :RLIMIT_NOFILE
167
- DEFAULT_POOL_SIZE = Process.getrlimit(Process::RLIMIT_NOFILE).first / 4
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.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[http://docs.seattlerb.org/net-http-pipeline/Net/HTTP/Pipeline.html]
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
- assert_in_delta Time.now, c.last_use
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
 
@@ -57,7 +57,7 @@ class TestNetHttpPersistentTimedStackMulti < Minitest::Test
57
57
  @stack.pop timeout: 0
58
58
  end
59
59
 
60
- assert_equal 'Waited 0 sec', e.message
60
+ assert_match 'Waited 0 sec', e.message
61
61
  end
62
62
 
63
63
  def test_pop_full
metadata CHANGED
@@ -1,35 +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.0
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDNjCCAh6gAwIBAgIBBzANBgkqhkiG9w0BAQsFADBBMRAwDgYDVQQDDAdkcmJy
14
- YWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZFgNu
15
- ZXQwHhcNMjAwNDE0MDQxNjM0WhcNMjEwNDE0MDQxNjM0WjBBMRAwDgYDVQQDDAdk
16
- cmJyYWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZ
17
- FgNuZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCbbgLrGLGIDE76
18
- LV/cvxdEzCuYuS3oG9PrSZnuDweySUfdp/so0cDq+j8bqy6OzZSw07gdjwFMSd6J
19
- U5ddZCVywn5nnAQ+Ui7jMW54CYt5/H6f2US6U0hQOjJR6cpfiymgxGdfyTiVcvTm
20
- Gj/okWrQl0NjYOYBpDi+9PPmaH2RmLJu0dB/NylsDnW5j6yN1BEI8MfJRR+HRKZY
21
- mUtgzBwF1V4KIZQ8EuL6I/nHVu07i6IkrpAgxpXUfdJQJi0oZAqXurAV3yTxkFwd
22
- g62YrrW26mDe+pZBzR6bpLE+PmXCzz7UxUq3AE0gPHbiMXie3EFE0oxnsU3lIduh
23
- sCANiQ8BAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
24
- BBS5k4Z75VSpdM0AclG2UvzFA/VW5DANBgkqhkiG9w0BAQsFAAOCAQEAcrJao+AD
25
- qFvUtuvzimPGJS1rtKJEvEvDTzEOnd4e+R+mVitEBp3AI8R4OZGf1wnPy7jYYtiL
26
- S8FhRBZRyXaQcvcL75eKicfIy8gPSg8d8YTs12BhXrF+ziTR6JJUB3DLkFjE3O84
27
- Aid+DdQFk1ERR/GvpA9wQcax8DXzc9ONoN/kGdruXLtXSEwmOGJgmSV9iKK2Ot+x
28
- 6A1NLSPq5zcsOzbmsaWlZphKnvH6oPqOLzMxwGJOz07/XXxICSYIccrWXdHZ3PPm
29
- UpBFtcBdupJTrY8t+BLoVN4zTlNqoDciUJBjHfem/2CiMy6oDqthQva1Kn8fquIf
30
- BHDiQW5MD5FN1g==
31
- -----END CERTIFICATE-----
32
- date: 2020-05-01 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2023-03-29 00:00:00.000000000 Z
33
12
  dependencies:
34
13
  - !ruby/object:Gem::Dependency
35
14
  name: connection_pool
@@ -45,88 +24,6 @@ dependencies:
45
24
  - - "~>"
46
25
  - !ruby/object:Gem::Version
47
26
  version: '2.2'
48
- - !ruby/object:Gem::Dependency
49
- name: minitest
50
- requirement: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '5.14'
55
- type: :development
56
- prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '5.14'
62
- - !ruby/object:Gem::Dependency
63
- name: hoe-bundler
64
- requirement: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.5'
69
- type: :development
70
- prerelease: false
71
- version_requirements: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.5'
76
- - !ruby/object:Gem::Dependency
77
- name: hoe-travis
78
- requirement: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.4'
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- version: 1.4.1
86
- type: :development
87
- prerelease: false
88
- version_requirements: !ruby/object:Gem::Requirement
89
- requirements:
90
- - - "~>"
91
- - !ruby/object:Gem::Version
92
- version: '1.4'
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- version: 1.4.1
96
- - !ruby/object:Gem::Dependency
97
- name: rdoc
98
- requirement: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: '4.0'
103
- - - "<"
104
- - !ruby/object:Gem::Version
105
- version: '7'
106
- type: :development
107
- prerelease: false
108
- version_requirements: !ruby/object:Gem::Requirement
109
- requirements:
110
- - - ">="
111
- - !ruby/object:Gem::Version
112
- version: '4.0'
113
- - - "<"
114
- - !ruby/object:Gem::Version
115
- version: '7'
116
- - !ruby/object:Gem::Dependency
117
- name: hoe
118
- requirement: !ruby/object:Gem::Requirement
119
- requirements:
120
- - - "~>"
121
- - !ruby/object:Gem::Version
122
- version: '3.22'
123
- type: :development
124
- prerelease: false
125
- version_requirements: !ruby/object:Gem::Requirement
126
- requirements:
127
- - - "~>"
128
- - !ruby/object:Gem::Version
129
- version: '3.22'
130
27
  description: |-
131
28
  Manages persistent connections using Net::HTTP including a thread pool for
132
29
  connecting to multiple hosts.
@@ -150,7 +47,6 @@ extra_rdoc_files:
150
47
  files:
151
48
  - ".autotest"
152
49
  - ".gemtest"
153
- - ".travis.yml"
154
50
  - Gemfile
155
51
  - History.txt
156
52
  - Manifest.txt
@@ -175,16 +71,16 @@ require_paths:
175
71
  - lib
176
72
  required_ruby_version: !ruby/object:Gem::Requirement
177
73
  requirements:
178
- - - "~>"
74
+ - - ">="
179
75
  - !ruby/object:Gem::Version
180
- version: '2.3'
76
+ version: '2.4'
181
77
  required_rubygems_version: !ruby/object:Gem::Requirement
182
78
  requirements:
183
79
  - - ">="
184
80
  - !ruby/object:Gem::Version
185
81
  version: '0'
186
82
  requirements: []
187
- rubygems_version: 3.0.3
83
+ rubygems_version: 3.0.3.1
188
84
  signing_key:
189
85
  specification_version: 4
190
86
  summary: Manages persistent connections using Net::HTTP including a thread pool for
checksums.yaml.gz.sig DELETED
@@ -1 +0,0 @@
1
- ,ar��O�C��3���pu�9�����1���WR���u'ђ�,����-�R����0��м��)AVv�ӧ��8X�n1��?�z��%k�����3��
+ Ϫ+lW2��RN��<D��a�w�惐R:p�*!��U���co��M�8u�(�a������O.K��˝}�>���Q甶+D��v�إB�,�Yq!^^��t�9.Ӽ�O`���.t)\�H9���<�~��'��ڈ����D�*
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
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
Binary file