protobuf-nats 0.9.0.pre1 → 0.9.0.pre2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b965b64f467078a814cd456821efec903fcff030
4
- data.tar.gz: 83f040bbc6b8d48d5421fb9f31c44278b7f5ef63
3
+ metadata.gz: b7b7a2ede49bfda45aadc50f2cc978e9ac6f4780
4
+ data.tar.gz: a6a6253219abc6417bcf87079da8d61694dfe941
5
5
  SHA512:
6
- metadata.gz: 2fce53579733468be93dece666e78ec435280fdb143d9155ea8302c43f70a4f59efcb5af8668eb5c2af85d1d415631fd5bcb2300bef8def906a3afc9ff58a7cd
7
- data.tar.gz: 23bf375eeae757647bedd11c19f2b02cf70d9d4b841820003856e87c8148963e4e4ca5b446d17050beefd966c1ab109315b33f9cc3f3434a74ac336b0900e910
6
+ metadata.gz: 3a6d7bc54084e79bf44ab56e1847823b37523eca4be6587509cf2a22682bdffd86ea25a574acac65a2e7e0dd92e04a1a173e0230a0b3ca02da1bad02db107400
7
+ data.tar.gz: a25d3136a2c8767f13fc163f298f905d69f19970db022ccdee4ee8baffaea402a54448770a822fa5b58218936f6e3e84406a8fc316aa0fc6360e17932be9c3eb
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ .ruby-*
1
2
  /.bundle/
2
3
  /.yardoc
3
4
  /Gemfile.lock
data/README.md CHANGED
@@ -47,6 +47,8 @@ used to allow JVM based servers to warm-up slowly to prevent jolts in runtime pe
47
47
 
48
48
  `PB_NATS_CLIENT_RECONNECT_DELAY` - If we detect a reconnect delay, we will wait this many seconds (default: the ACK timeout).
49
49
 
50
+ `PB_NATS_CLIENT_SUBSCRIPTION_POOL_SIZE` - If subscription pooling is desired for the request/response cycle then the pool size maximum should be set; the pool is lazy and therefore will only start new subscriptions as necessary (default: 0)
51
+
50
52
  `PROTOBUF_NATS_CONFIG_PATH` - Custom path to the config yaml (default: "config/protobuf_nats.yml").
51
53
 
52
54
  ### YAML Config
@@ -58,7 +58,7 @@ module Protobuf
58
58
  return_value = yield sub_inbox
59
59
  end
60
60
  else
61
- return_value = yield new_subscription_inbox
61
+ return_value = yield new_subscription_inbox
62
62
  end
63
63
 
64
64
  return_value
@@ -128,7 +128,7 @@ module Protobuf
128
128
  def send_request
129
129
  if use_subscription_pooling?
130
130
  available = self.class.subscription_pool.instance_variable_get("@available")
131
- ::ActiveSupport::Notifications.instrument "client.pool_availble_size.protobuf-nats", available.length
131
+ ::ActiveSupport::Notifications.instrument "client.subscription_pool_available_size.protobuf-nats", available.length
132
132
  end
133
133
 
134
134
  ::ActiveSupport::Notifications.instrument "client.request_duration.protobuf-nats" do
@@ -203,6 +203,12 @@ module Protobuf
203
203
  with_subscription do |sub_inbox|
204
204
  begin
205
205
  completed_request = false
206
+
207
+ if !sub_inbox.subscription.is_valid # replace the subscription if is has been pooled but is no longer valid (maybe a reconnect)
208
+ nats.unsubscribe(sub_inbox.subscription)
209
+ sub_inbox.swap(new_subscription_inbox) # this line replaces the sub_inbox in the connection pool if necessary
210
+ end
211
+
206
212
  nats.publish(subject, data, sub_inbox.inbox)
207
213
 
208
214
  # Wait for reply
@@ -1,5 +1,5 @@
1
1
  module Protobuf
2
2
  module Nats
3
- VERSION = "0.9.0.pre1"
3
+ VERSION = "0.9.0.pre2"
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.9.0.pre1
4
+ version: 0.9.0.pre2
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-11-05 00:00:00.000000000 Z
11
+ date: 2017-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  version: 1.3.1
200
200
  requirements: []
201
201
  rubyforge_project:
202
- rubygems_version: 2.5.1
202
+ rubygems_version: 2.6.13
203
203
  signing_key:
204
204
  specification_version: 4
205
205
  summary: ruby-protobuf client/server for nats