gruf 1.2.4 → 1.2.5
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/gruf/client.rb +10 -1
- data/lib/gruf/instrumentation/output_metadata_timer.rb +2 -0
- data/lib/gruf/service.rb +16 -1
- data/lib/gruf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7765e1ba50ecdc417020e4083e304f900845fa1b
|
4
|
+
data.tar.gz: e615c4331dac126796b304c0056070de88faeb15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2372e9d8ebd9d18edad57ba5985af76e28b9062503cd4c53658d5eb0b765c96a0a28a29ef50da0dd832607f7c9046a75560cd357ed0aee3cb229c33250bdf2d9
|
7
|
+
data.tar.gz: 3d8e0d3d1632f31c2e0838b2e1469059bebc5ce7fc8b153becffe51d29bd96d2b4997cfd115b98c6f8ae6aa5626d0b179cc4b31f3c0865f42cd0f2e9ea748e61
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@ Changelog for the gruf gem. This includes internal history before the gem was ma
|
|
2
2
|
|
3
3
|
### Pending release
|
4
4
|
|
5
|
+
### 1.2.5
|
6
|
+
|
7
|
+
- Fix reference issue for client and bidirectional streaming calls
|
8
|
+
|
5
9
|
### 1.2.4
|
6
10
|
|
7
11
|
- Loosen explicit Protobuf dependency now that 3.4.0.2 is released
|
data/lib/gruf/client.rb
CHANGED
@@ -91,7 +91,7 @@ module Gruf
|
|
91
91
|
# error type that was returned
|
92
92
|
def call(request_method, params = {}, metadata = {}, opts = {})
|
93
93
|
request_method = request_method.to_sym
|
94
|
-
req = request_object(request_method, params)
|
94
|
+
req = streaming_request?(request_method) ? params : request_object(request_method, params)
|
95
95
|
md = build_metadata(metadata)
|
96
96
|
call_sig = call_signature(request_method)
|
97
97
|
|
@@ -106,6 +106,15 @@ module Gruf
|
|
106
106
|
|
107
107
|
private
|
108
108
|
|
109
|
+
##
|
110
|
+
# @param [Symbol] request_method
|
111
|
+
# @return [Boolean]
|
112
|
+
#
|
113
|
+
def streaming_request?(request_method)
|
114
|
+
desc = rpc_desc(request_method)
|
115
|
+
desc && (desc.client_streamer? || desc.bidi_streamer?)
|
116
|
+
end
|
117
|
+
|
109
118
|
##
|
110
119
|
# Execute the given request to the service
|
111
120
|
#
|
@@ -27,6 +27,8 @@ module Gruf
|
|
27
27
|
# @return [Hash] The resulting output metadata with the timer attached
|
28
28
|
#
|
29
29
|
def call(rc)
|
30
|
+
return unless rc.active_call && rc.active_call.respond_to?(:output_metadata)
|
31
|
+
|
30
32
|
rc.active_call.output_metadata.update(metadata_key => rc.execution_time.to_s)
|
31
33
|
end
|
32
34
|
|
data/lib/gruf/service.rb
CHANGED
@@ -216,12 +216,27 @@ module Gruf
|
|
216
216
|
# @return [Object] The response object
|
217
217
|
#
|
218
218
|
def call_chain(original_call_sig, req, call, &block)
|
219
|
+
# this is a workaround until the gRPC core Ruby client implements interceptors
|
220
|
+
# due to the signatures being different for the different types of requests. After
|
221
|
+
# interceptors are added to gRPC core, we will need to release gruf 2.0 and redo
|
222
|
+
# the interceptor signatures for gruf
|
223
|
+
streamed_request = call.nil?
|
224
|
+
if streamed_request
|
225
|
+
call = req
|
226
|
+
req = nil
|
227
|
+
end
|
228
|
+
|
219
229
|
outer_around_call(original_call_sig, req, call) do
|
220
230
|
begin
|
221
231
|
before_call(original_call_sig, req, call)
|
222
232
|
|
223
233
|
result = around_call(original_call_sig, req, call) do
|
224
|
-
|
234
|
+
# send the actual request to gRPC
|
235
|
+
if streamed_request
|
236
|
+
send("#{original_call_sig}_without_intercept", call, &block)
|
237
|
+
else
|
238
|
+
send("#{original_call_sig}_without_intercept", req, call, &block)
|
239
|
+
end
|
225
240
|
end
|
226
241
|
rescue GRPC::BadStatus => e
|
227
242
|
result = e
|
data/lib/gruf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gruf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shaun McCormick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|