gruf 1.2.6 → 1.2.7

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: 475f72d5e3590bcbdbc32f8698bf835540c964c1
4
- data.tar.gz: 877dd14c01855fba9e2006bf50df04b07cfbb804
3
+ metadata.gz: 8494cc65922d13e3d9d70f0eeed43cb54cec22b0
4
+ data.tar.gz: e0afec068276451c09ad350d23ca165becb552b0
5
5
  SHA512:
6
- metadata.gz: 2451565946bade99073f6dc7d567d623761a2f35a6c7541fdfc6dd431c29046635e057a1da9441390cbae5e32c8a6eb85e8a913ea851a9f7cc3079ea8971d4e1
7
- data.tar.gz: 95d1fe70fde36eb85fae02c97cb518277f0d182f8d7bb5f659125b5d6bbcfa390e09707379c8969144384f34be782715d52c145ec83945bb37834f69405cf1be
6
+ metadata.gz: 6a783314fd5761fed60ee87426cb1d1aa78d515fc447232b88470a4b73e69b3f5102119f13cb6cea53086a45ef257d461aa467cc38a2dc09f3270b04e9638479
7
+ data.tar.gz: 2adc8447c02b004a67c06eb9d73b439afd00d1db1750046f4edbeb933686a737da82813fa71b16d4f087279056fb33c1dae821b5f98c9b19fd315a445be16dd8
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.7
6
+
7
+ - Fix issues where field errors were persisted in between separate calls
8
+
5
9
  ### 1.2.6
6
10
 
7
11
  - Fix issues with arity and bidirectional streaming
data/lib/gruf/server.rb CHANGED
@@ -24,8 +24,10 @@ module Gruf
24
24
 
25
25
  # @return [Array<Class>] The services this server is handling
26
26
  attr_accessor :services
27
-
27
+ # @return [GRPC::RpcServer] The underlying GRPC server instance
28
28
  attr_reader :server
29
+ # @return [Integer] The port the server is bound to
30
+ attr_reader :port
29
31
 
30
32
  ##
31
33
  # Initialize the server and load and setup the services
@@ -43,7 +45,7 @@ module Gruf
43
45
  def server
44
46
  unless @server
45
47
  @server = GRPC::RpcServer.new(Gruf.server_options)
46
- @server.add_http2_port(Gruf.server_binding_url, ssl_credentials)
48
+ @port = @server.add_http2_port(Gruf.server_binding_url, ssl_credentials)
47
49
  services.each do |s|
48
50
  @server.handle(s)
49
51
  end
data/lib/gruf/service.rb CHANGED
@@ -223,11 +223,14 @@ module Gruf
223
223
  # @param [Hash] metadata (Optional) Any metadata to inject into the trailing metadata for the response
224
224
  #
225
225
  def fail!(_req, call, error_code, app_code = nil, message = '', metadata = {})
226
- error.code = error_code.to_sym
227
- error.app_code = app_code ? app_code.to_sym : error.code
228
- error.message = message.to_s
229
- error.metadata = metadata
230
- error.fail!(call)
226
+ e = error
227
+ e.code = error_code.to_sym
228
+ e.app_code = app_code ? app_code.to_sym : error.code
229
+ e.message = message.to_s
230
+ e.metadata = metadata
231
+
232
+ cleanup!
233
+ e.fail!(call)
231
234
  end
232
235
 
233
236
  private
@@ -241,7 +244,7 @@ module Gruf
241
244
  # @return [Object] The response object
242
245
  #
243
246
  def call_chain(original_call_sig, req, call, &block)
244
- outer_around_call(original_call_sig, req, call) do
247
+ outer_result = outer_around_call(original_call_sig, req, call) do
245
248
  begin
246
249
  before_call(original_call_sig, req, call)
247
250
 
@@ -263,7 +266,10 @@ module Gruf
263
266
 
264
267
  result
265
268
  end
269
+ cleanup!
270
+ outer_result
266
271
  rescue GRPC::BadStatus
272
+ cleanup!
267
273
  raise
268
274
  rescue => e
269
275
  set_debug_info(e.message, e.backtrace) if Gruf.backtrace_on_error
@@ -316,5 +322,12 @@ module Gruf
316
322
  def error
317
323
  @error ||= Gruf::Error.new
318
324
  end
325
+
326
+ ##
327
+ # Cleanup after a service call
328
+ #
329
+ def cleanup!
330
+ remove_instance_variable(:@error) if instance_variable_defined?(:@error)
331
+ end
319
332
  end
320
333
  end
data/lib/gruf/version.rb CHANGED
@@ -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.6'.freeze
18
+ VERSION = '1.2.7'.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.6
4
+ version: 1.2.7
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-09-01 00:00:00.000000000 Z
11
+ date: 2017-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  requirements: []
161
161
  rubyforge_project:
162
- rubygems_version: 2.6.13
162
+ rubygems_version: 2.6.12
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: gRPC Ruby Framework