nats-pure 0.1.0 → 0.1.2

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: 3e87e20f03f5ef479937bce67c2133957a1e2d40
4
- data.tar.gz: d8b27723a8a054be7d5a6c20d9e7c42d8ee0932e
3
+ metadata.gz: 5b4990ce0be713e5b1797b7f5e81ce1f5ede4d46
4
+ data.tar.gz: cc3b911e3d7af1757ac85aebe25fd7f08c298668
5
5
  SHA512:
6
- metadata.gz: ba54415e67b435e27007500d070245a281dd7ba517472adbbce3e7de87822263f1518814fa0c51ab247979139902ff8faa938f15783498f22a07787a830c732b
7
- data.tar.gz: af88d16e6d1b9840681fb87a16854233ea45189403daf48be5c975408b4864f8d4893042e14868b59c772d1b992f4308d2773f6df118267b32ec2b8e25cec4a0
6
+ metadata.gz: ec94026ad13132ce40c3f85523f2f386ccb38683478e496a9f4ebf2222c80bf8a9c0ac9ad3b53fa0c174ea090f6cbf4f64ba738d0f727d3fb1a378fb7285f814
7
+ data.tar.gz: c5a26cd09afc2233d083a23798934fc842c63c84675c07c57c28b3b1786bd7232b367f72abf42d18b5a7ad37ec925b4e713f0154295ec26fdbbca02dbd86903d
@@ -200,11 +200,17 @@ module NATS
200
200
  # Capture sticky error
201
201
  synchronize { @last_err = e }
202
202
 
203
+ @err_cb.call(e) if @err_cb
204
+
203
205
  if should_not_reconnect?
204
206
  @disconnect_cb.call(e) if @disconnect_cb
205
207
  raise e
206
208
  end
207
209
 
210
+ # always sleep here to safe guard against errors before current[:was_connected]
211
+ # is set for the first time
212
+ sleep @options[:reconnect_time_wait] if @options[:reconnect_time_wait]
213
+
208
214
  # Continue retrying until there are no options left in the server pool
209
215
  retry
210
216
  end
@@ -880,6 +886,9 @@ module NATS
880
886
  rescue => e
881
887
  @last_err = e
882
888
 
889
+ # Trigger async error handler
890
+ @err_cb.call(e) if @err_cb
891
+
883
892
  # Continue retrying until there are no options left in the server pool
884
893
  retry
885
894
  end
@@ -972,9 +981,10 @@ module NATS
972
981
  addrinfo.each_with_index do |ai, i|
973
982
  begin
974
983
  @socket = connect_addrinfo(ai, @uri.port, @connect_timeout)
975
- rescue SystemCallError
984
+ break
985
+ rescue SystemCallError => e
976
986
  # Give up if no more available
977
- raise if addrinfo.length == i+1
987
+ raise e if addrinfo.length == i+1
978
988
  end
979
989
  end
980
990
 
@@ -1,7 +1,7 @@
1
1
  module NATS
2
2
  module IO
3
3
  # NOTE: These are all announced to the server on CONNECT
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  LANG = "#{RUBY_ENGINE}2".freeze
6
6
  PROTOCOL = 1
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nats-pure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Waldemar Quevedo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-07 00:00:00.000000000 Z
11
+ date: 2016-12-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: NATS is an open-source, high-performance, lightweight cloud messaging
14
14
  system.
@@ -41,7 +41,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
41
41
  version: '0'
42
42
  requirements: []
43
43
  rubyforge_project:
44
- rubygems_version: 2.5.1
44
+ rubygems_version: 2.5.2
45
45
  signing_key:
46
46
  specification_version: 4
47
47
  summary: NATS is an open-source, high-performance, lightweight cloud messaging system.