protobuf-nats 0.3.2 → 0.3.3

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: a55bbcf7a29b27d1d9cfd00b88579581f8ab581b
4
- data.tar.gz: fa5b7bafb1e967ee34cb79b3afef6119accb5efb
3
+ metadata.gz: f814c4c1e02c6a9b768e1ab2e0ed963af5098215
4
+ data.tar.gz: a2a120ca37a85cfe6bab4d505e0f4d48ddfba77b
5
5
  SHA512:
6
- metadata.gz: d0f35efe85018a2f3eede00b73b4c5c84e9d499a12f3e487655031a05522040ab029e599a0fe45d5cc311ceccdca501c21554d5c868cded997bfe7aed96f4e39
7
- data.tar.gz: c1bc44baeff5152bb07ec1abc4dbfa73209a02d7648f98178c453320fa5d67579537b29e887df6652eca40a026b4058bdf9adc6f87181c9cfc6035c6a2aefe13
6
+ metadata.gz: c307b1b2e4cf076047b612c0bdbec5baadecdc28c2dab623bf8932243a039702b105e137b7ba95e74b0934121f4b8f2d41a0a9c64306f7647eafe0c372031d19
7
+ data.tar.gz: ed0fc48cb9c2928eb7221602013bde0c3c9eb1297efa139450f5b1baebce5773e16ade799feefb00a6cc09518ade8c7973544c778f6ab33dbfcf985764ea95cd
@@ -21,25 +21,6 @@ module Protobuf
21
21
  @subscription_key_cache ||= {}
22
22
  end
23
23
 
24
- # This is an alternative to depending on #failure for invoking the error callback.
25
- # We never want to silence an error in the event that no callback is provided.
26
- def failure_handler
27
- yield
28
- rescue => error
29
- logger.debug { sign_message("Server failed request (invoking on_failure): #{error.inspect}") }
30
-
31
- begin
32
- if @failure_cb
33
- @failure_cb.call(error)
34
- else
35
- raise
36
- end
37
- ensure
38
- # Complete stats and log
39
- complete
40
- end
41
- end
42
-
43
24
  def ack_timeout
44
25
  @ack_timeout ||= if ::ENV.key?("PB_NATS_CLIENT_ACK_TIMEOUT")
45
26
  ::ENV["PB_NATS_CLIENT_ACK_TIMEOUT"].to_i
@@ -65,29 +46,28 @@ module Protobuf
65
46
  end
66
47
 
67
48
  def send_request
68
- failure_handler do
69
- begin
70
- retries ||= 3
71
-
72
- setup_connection
73
- request_options = {:timeout => response_timeout, :ack_timeout => ack_timeout}
74
- @response_data = nats_request_with_two_responses(cached_subscription_key, @request_data, request_options)
75
- parse_response
76
- rescue ::Protobuf::Nats::Errors::IOException => error
77
- ::Protobuf::Nats.log_error(error)
78
-
79
- delay = reconnect_delay
80
- logger.warn "An IOException was raised. We are going to sleep for #{delay} seconds."
81
- sleep delay
82
-
83
- retry if (retries -= 1) > 0
84
- raise
85
- rescue ::NATS::IO::Timeout
86
- # Nats response timeout.
87
- retry if (retries -= 1) > 0
88
- raise
89
- end
90
- end
49
+ retries ||= 3
50
+
51
+ setup_connection
52
+ request_options = {:timeout => response_timeout, :ack_timeout => ack_timeout}
53
+ @response_data = nats_request_with_two_responses(cached_subscription_key, @request_data, request_options)
54
+ parse_response
55
+ rescue ::Protobuf::Nats::Errors::IOException => error
56
+ ::Protobuf::Nats.log_error(error)
57
+
58
+ delay = reconnect_delay
59
+ logger.warn "An IOException was raised. We are going to sleep for #{delay} seconds."
60
+ sleep delay
61
+
62
+ retry if (retries -= 1) > 0
63
+ raise
64
+ rescue ::NATS::IO::Timeout
65
+ # Nats response timeout.
66
+ retry if (retries -= 1) > 0
67
+ raise
68
+ ensure
69
+ # Complete stats and log
70
+ complete
91
71
  end
92
72
 
93
73
  def cached_subscription_key
@@ -1,5 +1,5 @@
1
1
  module Protobuf
2
2
  module Nats
3
- VERSION = "0.3.2"
3
+ VERSION = "0.3.3"
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.3.2
4
+ version: 0.3.3
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-04-27 00:00:00.000000000 Z
11
+ date: 2017-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: protobuf