httpx 0.20.1 → 0.20.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d7bcf0e6c97e369caf28c209d551d4f9667745b6a6a530ae2efd328c611e0e5
4
- data.tar.gz: 822c0437afcefb35e7d4319f91e71c5b4c81720bd0d7a7763db1d1f8bfbc4b1a
3
+ metadata.gz: b49337207a605c716ef9a1043660239ced7f5060758148f905be6c1d5546a8bc
4
+ data.tar.gz: 732ffb35912e5176827941034b74ce2777d744e828e1ed86351bdd221f010d19
5
5
  SHA512:
6
- metadata.gz: 747e7d2ca2a4aee92f1774473e9b38565fec3879ee6b6d0ab3c4eeb1313740c6bbd3648c8c6f21b40903f4bf9bc842647b531968debcda747652afb483577b11
7
- data.tar.gz: 88d3bafe38437bebb42960d980dddc85e9e12a917c492203744ded3f93c79736feedf839604cd1a4b080a59c64c96c26c545808cc29d19bcdaa93fa55154bbef
6
+ metadata.gz: 5c1f12fa0d1675f8e8c478ea272456f910dc558b7836eaf0bfa6e916d29439e7dd093ffdde4903a43b474559909052df4d26872846e704c393045f10d496a53a
7
+ data.tar.gz: 9011bf6d1826ea2a44a3570f9dcbe9dc5bb319303809cf8b44247f9ac2bdb099ccc0895192155960df320dbdad4bebf009a7ec77dc1e37d1e8e27a59077efe5a
@@ -0,0 +1,7 @@
1
+ # 0.20.2
2
+
3
+ ## Bugfixes
4
+
5
+ * fix for selector timeout errors closing all connections and ignoring resolvers.
6
+
7
+ Timeout errors on select were being propagated to all pooled connections, although not all of them were being selected on, and not all of them having timed out. plus, resolver timeouts were doing the same, making connections fail with connection timeout error, rather than resolve timeout error. A patch was implemented, where the selector now yields an error to the selected connections, rather than plain raising exception.
@@ -276,6 +276,12 @@ module HTTPX
276
276
  @state == :open || @state == :inactive
277
277
  end
278
278
 
279
+ def raise_timeout_error(interval)
280
+ error = HTTPX::TimeoutError.new(interval, "timed out while waiting on select")
281
+ error.set_backtrace(caller)
282
+ on_error(error)
283
+ end
284
+
279
285
  private
280
286
 
281
287
  def connect
@@ -118,6 +118,10 @@ module HTTPX
118
118
  @timeouts.values_at(*hosts).reject(&:empty?).map(&:first).min
119
119
  end
120
120
 
121
+ def raise_timeout_error(interval)
122
+ do_retry(interval)
123
+ end
124
+
121
125
  private
122
126
 
123
127
  def calculate_interests
@@ -134,10 +138,10 @@ module HTTPX
134
138
  dwrite if calculate_interests == :w
135
139
  end
136
140
 
137
- def do_retry
141
+ def do_retry(loop_time = nil)
138
142
  return if @queries.empty? || !@start_timeout
139
143
 
140
- loop_time = Utils.elapsed_time(@start_timeout)
144
+ loop_time ||= Utils.elapsed_time(@start_timeout)
141
145
 
142
146
  query = @queries.first
143
147
 
@@ -74,7 +74,10 @@ class HTTPX::Selector
74
74
 
75
75
  readers, writers = IO.select(r, w, nil, interval)
76
76
 
77
- raise HTTPX::TimeoutError.new(interval, "timed out while waiting on select") if readers.nil? && writers.nil? && interval
77
+ if readers.nil? && writers.nil? && interval
78
+ [*r, *w].each { |io| io.raise_timeout_error(interval) }
79
+ return
80
+ end
78
81
  rescue IOError, SystemCallError
79
82
  @selectables.reject!(&:closed?)
80
83
  retry
@@ -108,7 +111,11 @@ class HTTPX::Selector
108
111
  when nil then return
109
112
  end
110
113
 
111
- raise HTTPX::TimeoutError.new(interval, "timed out while waiting on select") unless result || interval.nil?
114
+ unless result || interval.nil?
115
+ io.raise_timeout_error(interval)
116
+ return
117
+ end
118
+ # raise HTTPX::TimeoutError.new(interval, "timed out while waiting on select")
112
119
 
113
120
  yield io
114
121
  rescue IOError, SystemCallError
data/lib/httpx/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTPX
4
- VERSION = "0.20.1"
4
+ VERSION = "0.20.2"
5
5
  end
data/sig/connection.rbs CHANGED
@@ -72,6 +72,9 @@ module HTTPX
72
72
  def timeout: () -> Numeric?
73
73
 
74
74
  def deactivate: () -> void
75
+
76
+ def raise_timeout_error: (Numeric interval) -> void
77
+
75
78
  private
76
79
 
77
80
  def initialize: (String, URI::Generic, options) -> untyped
@@ -27,6 +27,8 @@ module HTTPX
27
27
 
28
28
  def timeout: () -> Numeric?
29
29
 
30
+ def raise_timeout_error: (Numeric interval) -> void
31
+
30
32
  private
31
33
 
32
34
  def initialize: (ip_family family, options options) -> void
@@ -35,7 +37,7 @@ module HTTPX
35
37
 
36
38
  def consume: () -> void
37
39
 
38
- def do_retry: () -> void
40
+ def do_retry: (?Numeric loop_time) -> void
39
41
 
40
42
  def dread: (Integer) -> void
41
43
  | () -> void
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.1
4
+ version: 0.20.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-21 00:00:00.000000000 Z
11
+ date: 2022-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2-next
@@ -82,6 +82,7 @@ extra_rdoc_files:
82
82
  - doc/release_notes/0_1_0.md
83
83
  - doc/release_notes/0_20_0.md
84
84
  - doc/release_notes/0_20_1.md
85
+ - doc/release_notes/0_20_2.md
85
86
  - doc/release_notes/0_2_0.md
86
87
  - doc/release_notes/0_2_1.md
87
88
  - doc/release_notes/0_3_0.md
@@ -156,6 +157,7 @@ files:
156
157
  - doc/release_notes/0_1_0.md
157
158
  - doc/release_notes/0_20_0.md
158
159
  - doc/release_notes/0_20_1.md
160
+ - doc/release_notes/0_20_2.md
159
161
  - doc/release_notes/0_2_0.md
160
162
  - doc/release_notes/0_2_1.md
161
163
  - doc/release_notes/0_3_0.md