async-grpc 0.4.0 → 0.5.0

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: b1e1ab7ce49d13b36bbee671e1598de070bc068921dc46b26671ca8c13a45a19
4
- data.tar.gz: fefcc712682312abdaf415ca87c9beaa5c81997332aebe3c50d366ba3157353d
3
+ metadata.gz: 0d86e69280d50aad838ac63b91dccd9a89d9bcdccafa13f24f053320cadd72be
4
+ data.tar.gz: ef7a1542c2336bd1e5b8557b4edbedb522d2451d94c3eae887ee2be79d13c500
5
5
  SHA512:
6
- metadata.gz: 98ff4adf8e4570de34415d400c56ece807cfb153619ea1c12a058c9cfb46577f7ff533c8310c1a4d6c7ab1f7936f21d4e9d5559315ae52772a532b71513f585a
7
- data.tar.gz: 5a6ccfc411717a17d8d6e2309ebd0710bf0226882d9cea239f9c73925115fbcfdccb2b6903dc84c13c9d1b401b5f9001bc20ffe5e1bf7c294f64d3b286ca8f33
6
+ metadata.gz: f06eaf7f8fa92f2e042ade8a7bc9737ea13770060c7a9f4a145aa849bc679716a83780d215bea5ce6b9e1f1a785a92651f2b64f64adeb8658ca3baf3d37c7c1e
7
+ data.tar.gz: 0c8e0a8a9a26a0c21e7bc2a8a2311377a1ebc105e0d5f2dd0155faf7c735672a4df3a3467154b38b37220528bb3f9834fb5307dbdbe0abb0bbd054ed5a3a8c4b
checksums.yaml.gz.sig CHANGED
Binary file
@@ -56,24 +56,31 @@ module Async
56
56
  end
57
57
 
58
58
  # Mark trailers and add status (if not already set by handler):
59
- if call.response&.headers
60
- call.response.headers.trailer!
61
-
59
+ if headers = call.response&.headers
62
60
  # Only add OK status if grpc-status hasn't been set by the handler:
63
- unless call.response.headers["grpc-status"]
64
- Protocol::GRPC::Metadata.add_status!(call.response.headers, status: Protocol::GRPC::Status::OK)
61
+ unless headers["grpc-status"]
62
+ Protocol::GRPC::Metadata.add_status!(headers, status: Protocol::GRPC::Status::OK)
65
63
  end
66
64
  end
67
65
  end
68
66
 
69
67
  def dispatch_to_service(service, handler_method, input, output, call, deadline, parent: Async::Task.current)
70
68
  if deadline
71
- parent.with_timeout(deadline) do
69
+ parent.with_timeout(deadline.remaining) do
72
70
  invoke_service(service, handler_method, input, output, call)
73
71
  end
74
72
  else
75
73
  invoke_service(service, handler_method, input, output, call)
76
74
  end
75
+ rescue Async::TimeoutError
76
+ # Close input and output streams:
77
+ input.close
78
+ output.close_write unless output.closed?
79
+
80
+ # Set DEADLINE_EXCEEDED status in trailers:
81
+ if headers = call.response&.headers
82
+ Protocol::GRPC::Metadata.add_status!(headers, status: Protocol::GRPC::Status::DEADLINE_EXCEEDED, message: "Deadline exceeded")
83
+ end
77
84
  end
78
85
 
79
86
  # Dispatch the request to the appropriate service.
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2025, by Samuel Williams.
4
+ # Copyright, 2025-2026, by Samuel Williams.
5
5
 
6
6
  # @namespace
7
7
  module Async
8
8
  # @namespace
9
9
  module GRPC
10
- VERSION = "0.4.0"
10
+ VERSION = "0.5.0"
11
11
  end
12
12
  end
13
13
 
data/readme.md CHANGED
@@ -24,6 +24,10 @@ Please see the [project documentation](https://socketry.github.io/async-grpc/) f
24
24
 
25
25
  Please see the [project releases](https://socketry.github.io/async-grpc/releases/index) for all releases.
26
26
 
27
+ ### v0.5.0
28
+
29
+ - Fix handling of timeouts/deadlines.
30
+
27
31
  ### v0.4.0
28
32
 
29
33
  - Fix handling of trailers.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.5.0
4
+
5
+ - Fix handling of timeouts/deadlines.
6
+
3
7
  ## v0.4.0
4
8
 
5
9
  - Fix handling of trailers.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-grpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file