async-grpc 0.4.0 → 0.5.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: b1e1ab7ce49d13b36bbee671e1598de070bc068921dc46b26671ca8c13a45a19
4
- data.tar.gz: fefcc712682312abdaf415ca87c9beaa5c81997332aebe3c50d366ba3157353d
3
+ metadata.gz: 219cdaeda983bb25f35394cea48f426917006b3934cf673a256423c049602120
4
+ data.tar.gz: dda6c3c9607a451a9447d19c340f5c06c9baa8321f0e39838d6fb2be026e8cb9
5
5
  SHA512:
6
- metadata.gz: 98ff4adf8e4570de34415d400c56ece807cfb153619ea1c12a058c9cfb46577f7ff533c8310c1a4d6c7ab1f7936f21d4e9d5559315ae52772a532b71513f585a
7
- data.tar.gz: 5a6ccfc411717a17d8d6e2309ebd0710bf0226882d9cea239f9c73925115fbcfdccb2b6903dc84c13c9d1b401b5f9001bc20ffe5e1bf7c294f64d3b286ca8f33
6
+ metadata.gz: ea120b857416b034f83665941f130040c5fa16de13f87889f5020121172250b221447d2284952143a6baca305ad42d67be6281673cb3a1bb6aea2a0bb0511b38
7
+ data.tar.gz: 340a5ba4fe97718e80047df7684aa0e5c7e07f900d2b2d5d7e8282e4bd28f84558502a9e010ddb19ab474bae138ee7019f95e8e8c91e21309b4ff8651d0b17b0
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.assign_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 => error
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.assign_status!(headers, status: Protocol::GRPC::Status::DEADLINE_EXCEEDED, message: "Deadline exceeded!", error: error)
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.1"
11
11
  end
12
12
  end
13
13
 
data/readme.md CHANGED
@@ -24,6 +24,14 @@ 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.1
28
+
29
+ - Better error logging on timeout.
30
+
31
+ ### v0.5.0
32
+
33
+ - Fix handling of timeouts/deadlines.
34
+
27
35
  ### v0.4.0
28
36
 
29
37
  - Fix handling of trailers.
data/releases.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Releases
2
2
 
3
+ ## v0.5.1
4
+
5
+ - Better error logging on timeout.
6
+
7
+ ## v0.5.0
8
+
9
+ - Fix handling of timeouts/deadlines.
10
+
3
11
  ## v0.4.0
4
12
 
5
13
  - 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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.5'
61
+ version: 0.11.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.5'
68
+ version: 0.11.0
69
69
  executables: []
70
70
  extensions: []
71
71
  extra_rdoc_files: []
metadata.gz.sig CHANGED
Binary file