async-http 0.82.1 → 0.82.3

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: 3a11ccce0d608ca64fbed5c7e5cc23428e25d618f0b6b68aa34e6be7516a6982
4
- data.tar.gz: 890277e43541eaacb5f9f756f697505bcf8443e5aeea7d99b43d23df94896f87
3
+ metadata.gz: 34b971dd39f2aeab82cdca2bdb30c6d51a8c05b920933e5daf8e5525a60b2362
4
+ data.tar.gz: 53d7cfbb2541b3d138198d2ab976e59b10709fb048c3cdaf9e371f21aeb8ae57
5
5
  SHA512:
6
- metadata.gz: 2748cb15c2ae647b7aad72c3151edf747f4c1a366c495c981a0a135d1219b4bccdf5f8433ca44e79d1e92f9e3d4e54a775747df97a0ecede05982e6451f538fb
7
- data.tar.gz: 0647bec2b9b92d5fddbf9ef43bdaa53d626026172d5dc0a922da0716a0c3cde75e8d586a12f79ad851f98994c30c6a1b534e78dd96bd83ee061778ee243cfb41
6
+ metadata.gz: 20bdd7ab4ebf36833e1e05542dbe8288534fd37963a7ad25552b35a2dc8cb1dd08729eaa38dda1bcec084e4534105231a5901af99cf0f28f4a65621315bcfd5a
7
+ data.tar.gz: 8e6d0f0e569ad1f37f50265231f2056099eacdd8f9a7a17bffff3f894f5fa50531a32a483ca11d5ff5d5d50c47cfbea4e31825319e4b7438a026df21cdb9e4d8
checksums.yaml.gz.sig CHANGED
Binary file
@@ -101,7 +101,7 @@ module Async
101
101
  # As we cache pool, it's possible these pool go bad (e.g. closed by remote host). In this case, we need to try again. It's up to the caller to impose a timeout on this. If this is the last attempt, we force a new connection.
102
102
  connection = @pool.acquire
103
103
 
104
- response = make_response(request, connection)
104
+ response = make_response(request, connection, attempt)
105
105
 
106
106
  # This signals that the ensure block below should not try to release the connection, because it's bound into the response which will be returned:
107
107
  connection = nil
@@ -140,6 +140,36 @@ module Async
140
140
  "#<#{self.class} authority=#{@authority.inspect}>"
141
141
  end
142
142
 
143
+ protected
144
+
145
+ def make_response(request, connection, attempt)
146
+ response = request.call(connection)
147
+
148
+ response.pool = @pool
149
+
150
+ return response
151
+ end
152
+
153
+ def assign_default_tags(tags)
154
+ tags[:endpoint] = @endpoint.to_s
155
+ tags[:protocol] = @protocol.to_s
156
+ end
157
+
158
+ def make_pool(**options)
159
+ if connection_limit = options.delete(:connection_limit)
160
+ warn "The connection_limit: option is deprecated, please use limit: instead.", uplevel: 2
161
+ options[:limit] = connection_limit
162
+ end
163
+
164
+ self.assign_default_tags(options[:tags] ||= {})
165
+
166
+ Async::Pool::Controller.wrap(**options) do
167
+ Console.logger.debug(self) {"Making connection to #{@endpoint.inspect}"}
168
+
169
+ @protocol.client(@endpoint.connect)
170
+ end
171
+ end
172
+
143
173
  Traces::Provider(self) do
144
174
  def call(request)
145
175
  attributes = {
@@ -178,35 +208,15 @@ module Async
178
208
  end
179
209
  end
180
210
  end
181
- end
182
-
183
- protected
184
-
185
- def make_response(request, connection)
186
- response = request.call(connection)
187
-
188
- response.pool = @pool
189
211
 
190
- return response
191
- end
192
-
193
- def assign_default_tags(tags)
194
- tags[:endpoint] = @endpoint.to_s
195
- tags[:protocol] = @protocol.to_s
196
- end
197
-
198
- def make_pool(**options)
199
- if connection_limit = options.delete(:connection_limit)
200
- warn "The connection_limit: option is deprecated, please use limit: instead.", uplevel: 2
201
- options[:limit] = connection_limit
202
- end
203
-
204
- self.assign_default_tags(options[:tags] ||= {})
205
-
206
- Async::Pool::Controller.wrap(**options) do
207
- Console.logger.debug(self) {"Making connection to #{@endpoint.inspect}"}
212
+ def make_response(request, connection, attempt)
213
+ attributes = {
214
+ attempt: attempt,
215
+ }
208
216
 
209
- @protocol.client(@endpoint.connect)
217
+ Traces.trace("async.http.client.make_response", attributes: attributes) do
218
+ super
219
+ end
210
220
  end
211
221
  end
212
222
  end
@@ -5,6 +5,8 @@
5
5
 
6
6
  require_relative "connection"
7
7
 
8
+ require "traces/provider"
9
+
8
10
  module Async
9
11
  module HTTP
10
12
  module Protocol
@@ -79,6 +81,20 @@ module Async
79
81
  self.close(error)
80
82
  raise
81
83
  end
84
+
85
+ Traces::Provider(self) do
86
+ def write_request(...)
87
+ Traces.trace("async.http.protocol.http1.client.write_request") do
88
+ super
89
+ end
90
+ end
91
+
92
+ def read_response(...)
93
+ Traces.trace("async.http.protocol.http1.client.read_response") do
94
+ super
95
+ end
96
+ end
97
+ end
82
98
  end
83
99
  end
84
100
  end
@@ -6,6 +6,7 @@
6
6
  require_relative "connection"
7
7
  require_relative "response"
8
8
 
9
+ require "traces/provider"
9
10
  require "protocol/http2/client"
10
11
 
11
12
  module Async
@@ -34,10 +35,32 @@ module Async
34
35
  @count += 1
35
36
 
36
37
  response = create_response
38
+ write_request(response, request)
39
+ read_response(response)
40
+
41
+ return response
42
+ end
43
+
44
+ def write_request(response, request)
37
45
  response.send_request(request)
46
+ end
47
+
48
+ def read_response(response)
38
49
  response.wait
50
+ end
51
+
52
+ Traces::Provider(self) do
53
+ def write_request(...)
54
+ Traces.trace("async.http.protocol.http2.client.write_request") do
55
+ super
56
+ end
57
+ end
39
58
 
40
- return response
59
+ def read_response(...)
60
+ Traces.trace("async.http.protocol.http2.client.read_response") do
61
+ super
62
+ end
63
+ end
41
64
  end
42
65
  end
43
66
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module HTTP
8
- VERSION = "0.82.1"
8
+ VERSION = "0.82.3"
9
9
  end
10
10
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.82.1
4
+ version: 0.82.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -58,7 +58,7 @@ cert_chain:
58
58
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
59
59
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
60
60
  -----END CERTIFICATE-----
61
- date: 2024-10-16 00:00:00.000000000 Z
61
+ date: 2024-11-03 00:00:00.000000000 Z
62
62
  dependencies:
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: async
metadata.gz.sig CHANGED
Binary file