fastly_nsq 0.9.4 → 0.9.5

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: 3af47b4a7762a8de4b950a4f7cdee29fa4e71c54
4
- data.tar.gz: 0be3725b061e18b5595ab88257dab5a34bd2c1b5
3
+ metadata.gz: 4cee7eb576e0bfa95f3d894c52e99e15585a3832
4
+ data.tar.gz: 4c84b8b5b2ab8f59d88599cb7e06acdf64ed3873
5
5
  SHA512:
6
- metadata.gz: 6f3e9b056529f7d7a737406d01795e1c2f9bb69a574fea54fc26caeacdc52320f1730ff815aa525734d0be81dd4bdff7ceff25cf5c28ebfec7a745bffce45279
7
- data.tar.gz: d08d74e00a7e8402849f467478f35c4deb7c62e2e76d5dc22d54bd2b3c44197ee80ed2e4aacbdf6ed1b51156ce96dd3037d746640f0620eb91aa54ccb741574b
6
+ metadata.gz: f00684ae35a919fb7b9c8cf0e08d6590aff4a5a36e101cbc8c3c36dff58b3e042e3ca5c1eb84b41a5fd41cb5a53e9c0e459ad4ce5470431d89819b05e2f8ca2b
7
+ data.tar.gz: 6ea4abebaf60a445f714060eaf27f97d8fd2f9b937ac25cf5b704171bd8aa53b29ce227dafc22a0c7720d07270e72fe8d27a958628c53da7d31f7a148fc8ca53
@@ -13,6 +13,13 @@ module FastlyNsq
13
13
  @channel = channel
14
14
  @tls_options = TlsOptions.as_hash(tls_options)
15
15
  @connector = connector
16
+ Timeout.timeout(5) do
17
+ sleep(0.1) until connection.connected?
18
+ end
19
+ rescue Timeout::Error => error
20
+ FastlyNsq.logger.error "Consumer for #{topic} failed to connect!"
21
+ connection.terminate
22
+ raise error
16
23
  end
17
24
 
18
25
  private
@@ -60,6 +60,10 @@ module FastlyNsq
60
60
  def initialize(nsqlookupd: nil, topic:, channel:, tls_v1: nil, tls_options: nil)
61
61
  end
62
62
 
63
+ def connected?
64
+ true
65
+ end
66
+
63
67
  def pop(delay = FakeBackend.delay)
64
68
  message = nil
65
69
 
@@ -14,7 +14,7 @@ module FastlyNsq
14
14
  sleep(0.1) until connection.connected?
15
15
  end
16
16
  rescue Timeout::Error => error
17
- logger.error "Producer for #{topic} failed to connect!"
17
+ FastlyNsq.logger.error "Producer for #{topic} failed to connect!"
18
18
  connection.terminate
19
19
  raise error
20
20
  end
@@ -1,3 +1,3 @@
1
1
  module FastlyNsq
2
- VERSION = '0.9.4'.freeze
2
+ VERSION = '0.9.5'.freeze
3
3
  end
@@ -6,7 +6,7 @@ RSpec.describe FastlyNsq::Consumer do
6
6
  let(:consumer) { FastlyNsq::Consumer.new topic: topic, channel: channel }
7
7
 
8
8
  describe 'when connected to a backend Consumer' do
9
- let(:backend) { instance_double FastlyNsq::FakeBackend::Consumer, pop: nil, pop_without_blocking: nil, size: nil, terminate: nil }
9
+ let(:backend) { instance_double FastlyNsq::FakeBackend::Consumer, pop: nil, pop_without_blocking: nil, size: nil, terminate: nil, connected?: true }
10
10
  let(:connector) { double 'Connector strategy', new: backend }
11
11
 
12
12
  let(:consumer) do
@@ -45,6 +45,10 @@ RSpec.describe FastlyNsq::Consumer do
45
45
  self
46
46
  end
47
47
 
48
+ def connected?
49
+ true
50
+ end
51
+
48
52
  def terminate
49
53
  raise 'Already terminated once' unless @@never_terminated
50
54
  @@never_terminated = false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastly_nsq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommy O'Neil
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-04-13 00:00:00.000000000 Z
14
+ date: 2017-05-25 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: awesome_print