smart-que 0.2.3 → 0.2.4

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: 1836ac2d48717aee44d47c1c5025cc69c34ac58d
4
- data.tar.gz: 3ba9f72b6b3185eeb72d75bc84250f98ad4983f4
3
+ metadata.gz: d1bd51aadd5975296cea9f91b4dc5a2ee8eabf41
4
+ data.tar.gz: b3129e1bd3c29c76b0de0d3f21477584541a61b8
5
5
  SHA512:
6
- metadata.gz: 138dfac1cba953b04d0f252e78fc3dee607aea276b960af1d5809f65b31fa19bcb34d54e154859fd5be828682b311a6cec5a9afe7173240069c4f283d990dc2f
7
- data.tar.gz: 39554d1078fe45df50dc11c97e2204fa308aa5392dfa9e937074f46b8e10580f479a82a5849d696d0cc3bc24151f393736d938cd0b86c44abe11891ab9fb3e52
6
+ metadata.gz: ec96c1915582d8217de71c79326c4b2f2336711bfa59e7e4ae67772eb1d83ee6bd31ae200f58f2063b233d9b02beb390d195a88df1ea838218fdbabbc5b9b9ad
7
+ data.tar.gz: 12556476f004eb37ed2e23d39c4f2a8a134cae9497809357e94a3acac45e0fc249e0d5744fd32881069efb10cd51b65298360ee0e4c3588f20cf52411b5c686d
data/Gemfile CHANGED
@@ -9,7 +9,7 @@ gemspec
9
9
  gem "bunny", '~> 2.11.0'
10
10
 
11
11
  # Channel Connections
12
- gem "connection_pool", '~> 2.2.1'
12
+ gem "connection_pool", '~> 2.2.2'
13
13
 
14
14
  gem "pry"
15
15
  gem 'guard'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smart-que (0.2.2)
4
+ smart-que (0.2.4)
5
5
  bunny (~> 2.11)
6
6
  connection_pool (~> 2.2)
7
7
 
@@ -59,7 +59,7 @@ PLATFORMS
59
59
  DEPENDENCIES
60
60
  bundler (~> 1.16)
61
61
  bunny (~> 2.11.0)
62
- connection_pool (~> 2.2.1)
62
+ connection_pool (~> 2.2.2)
63
63
  guard
64
64
  guard-minitest
65
65
  minitest (~> 5.11)
@@ -25,7 +25,11 @@ module Consumers
25
25
 
26
26
  # Create channel with the established connection.
27
27
  def channel
28
- @channel ||= connection.create_channel
28
+ # Create new channel if closed
29
+ if @channel.nil? || @channel.closed?
30
+ @channel = connection.create_channel
31
+ end
32
+ @channel
29
33
  end
30
34
 
31
35
  def config
@@ -8,17 +8,12 @@ module SmartQue
8
8
  ::SmartQue.config.queues
9
9
  end
10
10
 
11
- # Methods related to bunny exchange, channels, queues
12
- def channel_pool
13
- @channel_pool ||= ConnectionPool.new do
14
- connection.create_channel
15
- end
16
- end
17
-
18
11
  def channel
19
- channel_pool.with do |channel|
20
- channel
12
+ # Create new channel if closed
13
+ if @channel.nil? || @channel.closed?
14
+ @channel = connection.create_channel
21
15
  end
16
+ @channel
22
17
  end
23
18
 
24
19
  # Direct exchange
@@ -1,3 +1,3 @@
1
1
  module SmartQue
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
data/lib/smart_que.rb CHANGED
@@ -30,6 +30,11 @@ module SmartQue
30
30
  end
31
31
 
32
32
  @conn_pool.with do |conn|
33
+ # Reestablish connection if closed
34
+ unless conn.open?
35
+ conn.start
36
+ end
37
+ # Return connection object
33
38
  conn
34
39
  end
35
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart-que
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ashik Salman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-17 00:00:00.000000000 Z
11
+ date: 2018-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny