protobuf-nats 0.6.0.pre1 → 0.6.0

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: '0388b13bc49e6bbb528a8749d02b47b220933ac0'
4
- data.tar.gz: 250e52352f75557ee911b0afd5095ae8428bdcaf
3
+ metadata.gz: 2161460631f9da05ed8476799eec44dad8c9cd62
4
+ data.tar.gz: af9204023684c1aa0f233454de7a1fec2cceac63
5
5
  SHA512:
6
- metadata.gz: 3fdec8891afa18de68624fa9f476ec2bfcc59b01bdaff3788ffe0979ad77f64d6e3d589c313d16af142688ace7ee6ab17cec670e241e57f798bba160880bd6ea
7
- data.tar.gz: e1bb774b5d1971e4704eb423202c1dec9adb1e30158b29acd9d46615a1e8e0fb43b5d64a9c72ff33db7e1369eb1eff4452e4667fde5bef30709f29fc5eb4d76c
6
+ metadata.gz: 601753df1bf104f0af11ce6259210dbfad8eb508ace11563f52d7a0a5a4c6c67baf411c43316e60e25703eed824f639620b934dc8c27d073f61733f136c032ff
7
+ data.tar.gz: ed8be857402c974a386fbe5f272a3a00ca12ea3af0504a6648a27688e16ff35785422f6df404b0a12dc4e53d9397b272c223b35277b1c67e324740357da46a9d
@@ -80,11 +80,11 @@ module Protobuf
80
80
  case @response_data
81
81
  when :ack_timeout
82
82
  next if (retries -= 1) > 0
83
- raise ::NATS::IO::Timeout
83
+ raise ::Protobuf::Nats::Errors::RequestTimeout
84
84
  when :nack
85
85
  interval = nack_backoff_intervals[nack_retry]
86
86
  nack_retry += 1
87
- raise ::NATS::IO::Timeout if interval.nil?
87
+ raise ::Protobuf::Nats::Errors::RequestTimeout if interval.nil?
88
88
  sleep((interval + nack_backoff_splay)/1000.0)
89
89
  next
90
90
  end
@@ -138,18 +138,20 @@ module Protobuf
138
138
  # Wait for reply
139
139
  first_message = nats.next_message(sub, ack_timeout)
140
140
  return :ack_timeout if first_message.nil?
141
- return :nack if first_message.data == ::Protobuf::Nats::Messages::NACK
141
+ first_message_data = first_message.data
142
+ return :nack if first_message_data == ::Protobuf::Nats::Messages::NACK
142
143
 
143
144
  second_message = nats.next_message(sub, timeout)
144
- fail(::NATS::IO::Timeout, subject) if second_message.nil?
145
+ second_message_data = second_message.nil? ? nil : second_message.data
145
146
 
146
147
  # Check messages
147
148
  response = case ::Protobuf::Nats::Messages::ACK
148
- when first_message.data then second_message.data
149
- when second_message.data then first_message.data
149
+ when first_message_data then second_message_data
150
+ when second_message_data then first_message_data
151
+ else return :ack_timeout
150
152
  end
151
153
 
152
- fail(::NATS::IO::Timeout, subject) unless response
154
+ fail(::Protobuf::Nats::Errors::ResponseTimeout, subject) unless response
153
155
 
154
156
  response
155
157
  ensure
@@ -197,9 +199,10 @@ module Protobuf
197
199
  response = case ::Protobuf::Nats::Messages::ACK
198
200
  when first_message then second_message
199
201
  when second_message then first_message
202
+ else return :ack_timeout
200
203
  end
201
204
 
202
- fail(::NATS::IO::Timeout, subject) unless response
205
+ fail(::Protobuf::Nats::Errors::ResponseTimeout, subject) unless response
203
206
 
204
207
  response
205
208
  ensure
@@ -1,6 +1,15 @@
1
1
  module Protobuf
2
2
  module Nats
3
3
  module Errors
4
+ class Base < ::StandardError
5
+ end
6
+
7
+ class RequestTimeout < Base
8
+ end
9
+
10
+ class ResponseTimeout < Base
11
+ end
12
+
4
13
  class MriIOException < ::StandardError
5
14
  end
6
15
 
@@ -58,7 +58,8 @@ module Protobuf
58
58
  if was_enqueued
59
59
  nats.publish(reply_id, ::Protobuf::Nats::Messages::ACK)
60
60
  else
61
- nats.publish(reply_id, ::Protobuf::Nats::Messages::NACK)
61
+ # TODO: Uncomment once we can roll out NACK messages without a 60 second timeout
62
+ # nats.publish(reply_id, ::Protobuf::Nats::Messages::NACK)
62
63
  end
63
64
 
64
65
  was_enqueued
@@ -1,5 +1,5 @@
1
1
  module Protobuf
2
2
  module Nats
3
- VERSION = "0.6.0.pre1"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobuf-nats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.pre1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Dewitt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-01 00:00:00.000000000 Z
11
+ date: 2017-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: protobuf
@@ -166,9 +166,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
166
166
  version: '0'
167
167
  required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  requirements:
169
- - - ">"
169
+ - - ">="
170
170
  - !ruby/object:Gem::Version
171
- version: 1.3.1
171
+ version: '0'
172
172
  requirements: []
173
173
  rubyforge_project:
174
174
  rubygems_version: 2.5.2