protobuf-nats 0.6.0.pre1 → 0.6.0
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/lib/protobuf/nats/client.rb +11 -8
- data/lib/protobuf/nats/errors.rb +9 -0
- data/lib/protobuf/nats/server.rb +2 -1
- data/lib/protobuf/nats/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2161460631f9da05ed8476799eec44dad8c9cd62
|
4
|
+
data.tar.gz: af9204023684c1aa0f233454de7a1fec2cceac63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 601753df1bf104f0af11ce6259210dbfad8eb508ace11563f52d7a0a5a4c6c67baf411c43316e60e25703eed824f639620b934dc8c27d073f61733f136c032ff
|
7
|
+
data.tar.gz: ed8be857402c974a386fbe5f272a3a00ca12ea3af0504a6648a27688e16ff35785422f6df404b0a12dc4e53d9397b272c223b35277b1c67e324740357da46a9d
|
data/lib/protobuf/nats/client.rb
CHANGED
@@ -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 ::
|
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 ::
|
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
|
-
|
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
|
-
|
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
|
149
|
-
when
|
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(::
|
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(::
|
205
|
+
fail(::Protobuf::Nats::Errors::ResponseTimeout, subject) unless response
|
203
206
|
|
204
207
|
response
|
205
208
|
ensure
|
data/lib/protobuf/nats/errors.rb
CHANGED
data/lib/protobuf/nats/server.rb
CHANGED
@@ -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
|
-
|
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
|
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
|
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-
|
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:
|
171
|
+
version: '0'
|
172
172
|
requirements: []
|
173
173
|
rubyforge_project:
|
174
174
|
rubygems_version: 2.5.2
|