async-http 0.89.0 → 0.90.1

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: 7b240b006b75c0a01b07afc6245603c28e272d47f6a5cc2beeb4af62637733a5
4
- data.tar.gz: 6a9e111b0845c065e812c71232dac7ccde12b4c3e4cfa0f74feec21c1bdac331
3
+ metadata.gz: e74d693721abbb9bc162a7f22882a3d27fbb9be683af44c943d3d59b1a2f465b
4
+ data.tar.gz: 4077df54daacf4c038562b0224acb3534fdc696dfe7aa4eb0184aa747dcd6ac0
5
5
  SHA512:
6
- metadata.gz: '0528d35edbb15f8685c54168c79857f4554e75ae5e1f866ae61fc3f407268211d3ecd342ee3afc61d6c320da03affd1f4f7a98d434b75eb2cad6a5a6667e3204'
7
- data.tar.gz: 906ea0d679469fbebce890bad4c04c57b94b9f5e0218c113dfd2b05c1be99cb9ff9285e49b1d064582219af1ccd6150defb0622477d3fea4773cf3547f9cdaee
6
+ metadata.gz: e49949bc6c4328f5d443c4b5a99affbdc667c5982791b7a3ab752904deadac12bb220a2d8cd9fef65de8bcebfebda43053dea0aa0ee852e738f8ae53e02a1d66
7
+ data.tar.gz: cae2477a3a76677ce281aa8bb4046968b1367b825a40e556ab1b15dca62916a2074d2b3c4d828b93b820c765109353402ffa60af771b82601f73c69415035e03
checksums.yaml.gz.sig CHANGED
Binary file
@@ -53,7 +53,6 @@ module Async
53
53
 
54
54
  @head.close_write
55
55
  rescue => error
56
- raise
57
56
  ensure
58
57
  @input.close(error)
59
58
 
@@ -71,7 +70,6 @@ module Async
71
70
  @output.write(chunk)
72
71
  end
73
72
  rescue => error
74
- raise
75
73
  ensure
76
74
  @output.close_write(error)
77
75
 
@@ -80,9 +80,8 @@ module Async
80
80
  end
81
81
 
82
82
  def close
83
- while @pool.busy?
83
+ @pool.wait_until_free do
84
84
  Console.warn(self) {"Waiting for #{@protocol} pool to drain: #{@pool}"}
85
- @pool.wait
86
85
  end
87
86
 
88
87
  @pool.close
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module HTTP
8
- VERSION = "0.89.0"
8
+ VERSION = "0.90.1"
9
9
  end
10
10
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2025, by Samuel Williams.
5
+
6
+ require_relative "../../../../async/http/client"
7
+ require "metrics/provider"
8
+
9
+ Metrics::Provider(Async::HTTP::Client) do
10
+ ASYNC_HTTP_CLIENT_REQUEST_INITIATED = Metrics.metric("async.http.client.request.initiated", :counter, description: "The number of HTTP client requests initiated.")
11
+ ASYNC_HTTP_CLIENT_REQUEST_FINISHED = Metrics.metric("async.http.client.request.finished", :counter, description: "The number of HTTP client requests finished.")
12
+
13
+ def make_response(request, connection, attempt)
14
+ ASYNC_HTTP_CLIENT_REQUEST_INITIATED.emit(1, tags: ["method:#{request.method}"])
15
+
16
+ response = super(request, connection, attempt)
17
+
18
+ ASYNC_HTTP_CLIENT_REQUEST_FINISHED.emit(1, tags: ["method:#{request.method}", "status:#{response.status}"])
19
+
20
+ return response
21
+ ensure
22
+ unless response
23
+ ASYNC_HTTP_CLIENT_REQUEST_FINISHED.emit(1, tags: ["method:#{request.method}", "status:failed"])
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2025, by Samuel Williams.
5
+
6
+ require_relative "../../../../async/http/server"
7
+ require "metrics/provider"
8
+
9
+ Metrics::Provider(Async::HTTP::Server) do
10
+ ASYNC_HTTP_SERVER_REQUEST_INITIATED = Metrics.metric("async.http.server.request.initiated", :counter, description: "The number of HTTP server requests initiated.")
11
+ ASYNC_HTTP_SERVER_REQUEST_FINISHED = Metrics.metric("async.http.server.request.finished", :counter, description: "The number of HTTP server requests finished.")
12
+
13
+ def call(request)
14
+ ASYNC_HTTP_SERVER_REQUEST_INITIATED.emit(1, tags: ["method:#{request.method}"])
15
+
16
+ if response = super(request)
17
+ ASYNC_HTTP_SERVER_REQUEST_FINISHED.emit(1, tags: ["method:#{request.method}", "status:#{response.status}"])
18
+ return response
19
+ else
20
+ return nil
21
+ end
22
+ ensure
23
+ unless response
24
+ ASYNC_HTTP_SERVER_REQUEST_FINISHED.emit(1, tags: ["method:#{request.method}", "status:failed"])
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "http/client"
4
+ require_relative "http/server"
data/readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Async::HTTP
2
2
 
3
- An asynchronous client and server implementation of HTTP/1.0, HTTP/1.1 and HTTP/2 including TLS. Support for streaming requests and responses. Built on top of [async](https://github.com/socketry/async) and [async-io](https://github.com/socketry/async-io). [falcon](https://github.com/socketry/falcon) provides a rack-compatible server.
3
+ An asynchronous client and server implementation of HTTP/1.0, HTTP/1.1 and HTTP/2 including TLS. Support for streaming requests and responses. Built on top of [async](https://github.com/socketry/async), [io-endpoint](https://github.com/socketry/io-endpoint) and [io-stream](https://github.com/socketry/io-stream). [falcon](https://github.com/socketry/falcon) provides a rack-compatible server.
4
4
 
5
5
  [![Development Status](https://github.com/socketry/async-http/workflows/Test/badge.svg)](https://github.com/socketry/async-http/actions?workflow=Test)
6
6
 
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.89.0
4
+ version: 0.90.1
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: 2025-04-28 00:00:00.000000000 Z
61
+ date: 1980-01-02 00:00:00.000000000 Z
62
62
  dependencies:
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: async
@@ -80,14 +80,14 @@ dependencies:
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '0.9'
83
+ version: '0.11'
84
84
  type: :runtime
85
85
  prerelease: false
86
86
  version_requirements: !ruby/object:Gem::Requirement
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '0.9'
90
+ version: '0.11'
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: io-endpoint
93
93
  requirement: !ruby/object:Gem::Requirement
@@ -235,6 +235,9 @@ files:
235
235
  - lib/async/http/server.rb
236
236
  - lib/async/http/statistics.rb
237
237
  - lib/async/http/version.rb
238
+ - lib/metrics/provider/async/http.rb
239
+ - lib/metrics/provider/async/http/client.rb
240
+ - lib/metrics/provider/async/http/server.rb
238
241
  - license.md
239
242
  - readme.md
240
243
  - releases.md
@@ -258,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
261
  - !ruby/object:Gem::Version
259
262
  version: '0'
260
263
  requirements: []
261
- rubygems_version: 3.6.2
264
+ rubygems_version: 3.6.9
262
265
  specification_version: 4
263
266
  summary: A HTTP client and server library.
264
267
  test_files: []
metadata.gz.sig CHANGED
Binary file