sevak 0.5.1 → 0.5.2

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: 9bc2716b6828ac44e65f3cb0064ca4f5bec284d3
4
- data.tar.gz: 3ef8b3923f1226b9fdb4f540f2767c2fef6d39ff
3
+ metadata.gz: a5e8f35cf1b3097bb259f85e1ca586ee1e66ea87
4
+ data.tar.gz: 7cf22996f04bb9952ad9d40b2f7cba0ed586ed34
5
5
  SHA512:
6
- metadata.gz: 16b67a229562bdede525520548b1c366f9d1383d57aa30f570bc556edda2c3ab12c1ffe210c43510823deefe80b2931f17c690705bf130255dc3965b733bde46
7
- data.tar.gz: f058c6348509be14921295f9e304b2356a78a4cd312053388dcb1a66965bb775b6fd4b1b808db0ab5bf2ba8b2ac02a7058437eeec7acecaf6e062cbf06d3bc6f
6
+ metadata.gz: 9992953e0418d33dabce5048f43e3181ae585df164a31ca823515c7cebdea02dd982315e6fe80e4a5dd8a7c8a27c6a78f52e731bbb398c4127c4a71e2fd6b13a
7
+ data.tar.gz: d133091616122c12d31e3581716cdac664ff7dbce1add4ed78d8afa11c26bac010f94298d2735df4e8813da174fed956abb2f285907358ac8a44bf57e749121c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sevak (0.5.0)
4
+ sevak (0.5.2)
5
5
  bunny (~> 2.7)
6
6
 
7
7
  GEM
@@ -29,7 +29,7 @@ module Sevak
29
29
  end
30
30
 
31
31
  def channel
32
- @channel ||= connection.create_channel
32
+ (@channel && @channel.open?)? @channel : (@channel = connection.create_channel)
33
33
  end
34
34
 
35
35
  def message_count
@@ -1,15 +1,26 @@
1
1
  module Sevak
2
2
  module Core
3
3
  def connection
4
- return @conn if @conn
5
- @conn ||= Bunny.new(
6
- host: config.host,
7
- port: config.port,
8
- username: config.user,
9
- password: config.password)
10
-
11
- @conn.start
12
- @conn
4
+ attempt = 0
5
+ begin
6
+ return @conn if (@conn && @conn.open?)
7
+ host = config.host.kind_of?(Array) ? config.host : [config.host]
8
+ @conn = Bunny.new(
9
+ hosts: host,
10
+ port: config.port,
11
+ username: config.user,
12
+ password: config.password)
13
+ @conn.start
14
+ @conn
15
+ rescue Bunny::TCPConnectionFailedForAllHosts => e
16
+ attempt += 1
17
+ sleep(0.001)
18
+ retry if attempt < 10
19
+ rescue Bunny::TCPConnectionFailed => e
20
+ attempt += 1
21
+ sleep(0.001)
22
+ retry if attempt < 10
23
+ end
13
24
  end
14
25
 
15
26
  def log(data)
@@ -21,4 +32,4 @@ module Sevak
21
32
  ::Sevak.config
22
33
  end
23
34
  end
24
- end
35
+ end
@@ -14,7 +14,7 @@ module Sevak
14
14
  end
15
15
 
16
16
  def channel
17
- @channel ||= connection.create_channel
17
+ (@channel && @channel.open?)? @channel : (@channel = connection.create_channel)
18
18
  end
19
19
 
20
20
  def queue(queue_name)
@@ -1,3 +1,3 @@
1
1
  module Sevak
2
- VERSION = '0.5.1'
2
+ VERSION = '0.5.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sevak
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deepak Kumar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-24 00:00:00.000000000 Z
11
+ date: 2019-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny