gruf 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a89536c6ad70dba812d8cb87b9220fc91ddc9e89
4
- data.tar.gz: 629b82c3c4db84871a5799542466097ab794c0ce
3
+ metadata.gz: 7765e1ba50ecdc417020e4083e304f900845fa1b
4
+ data.tar.gz: e615c4331dac126796b304c0056070de88faeb15
5
5
  SHA512:
6
- metadata.gz: cf8224f3487652a66ed038376cfa80d19241792c39d8ee0f409d24c9e635f964ca2750ea0194bd4f1252add9a541abb336709626a7eb36d0ba47fcb417348db1
7
- data.tar.gz: 2966de34dae6ef0d9a9b2e27853dd4b7171a27791f08a224ad3111e0a01c9a1e80c48f4d96e72cc95fa9f166588a9f002706c9547f5203a204f53744017093eb
6
+ metadata.gz: 2372e9d8ebd9d18edad57ba5985af76e28b9062503cd4c53658d5eb0b765c96a0a28a29ef50da0dd832607f7c9046a75560cd357ed0aee3cb229c33250bdf2d9
7
+ data.tar.gz: 3d8e0d3d1632f31c2e0838b2e1469059bebc5ce7fc8b153becffe51d29bd96d2b4997cfd115b98c6f8ae6aa5626d0b179cc4b31f3c0865f42cd0f2e9ea748e61
@@ -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
@@ -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
 
@@ -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
- send("#{original_call_sig}_without_intercept", req, call, &block) # send the actual request to gRPC
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
@@ -15,5 +15,5 @@
15
15
  # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
16
  #
17
17
  module Gruf
18
- VERSION = '1.2.4'.freeze
18
+ VERSION = '1.2.5'.freeze
19
19
  end
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
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-24 00:00:00.000000000 Z
11
+ date: 2017-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler