multiple_man 0.5.7 → 0.5.8

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: 91862d63ba5ac6bd05ea7724c6e3b85130596c24
4
- data.tar.gz: eda76e877da86d653c274aaa50a7671d951a9411
3
+ metadata.gz: 14b664ec408ce39903e299ff4be21513e3925014
4
+ data.tar.gz: 00b8579e4aeaa8e8697e5fa963646aef68757377
5
5
  SHA512:
6
- metadata.gz: 0d202cbbfed76fd925469f740818ae2b3b5f9db5665fa7191ef61ad7a1289760729a28ba27545a022fee80a32171593ccac2b0c3ffd570ddd86190af50c602d8
7
- data.tar.gz: ad2c2de8477150928208923a824f8c278edb872f32bdf3b6d28eb9da4a6d6d23c555a0a11de7053a19ed3be00f2884c1f6d8925dc83a8a41aaf7505a767f87c7
6
+ metadata.gz: acaec63c148e65ea63833d342fe28f1de23c80d07074dbf413531860fd9fda3ff4a334a6500c23cd2181fd908abbc9c78c03af475f67e5e0e734d491c7c7149f
7
+ data.tar.gz: f5620fc66f82bcb0708b8a564b472d1ac5ba98aa1742e0502b6e02b37629f3809dbe862f5809fa54945321fc03e87d0e54376f98bd18b8c9c6e814a981fe018a
@@ -4,12 +4,16 @@ require 'active_support/core_ext/module'
4
4
 
5
5
  module MultipleMan
6
6
  class Connection
7
+ @mutex = Mutex.new
8
+
7
9
  def self.connection
8
- @connection ||= begin
9
- connection = Bunny.new(MultipleMan.configuration.connection)
10
- MultipleMan.logger.debug "Connecting to #{MultipleMan.configuration.connection}"
11
- connection.start
12
- connection
10
+ @mutex.synchronize do
11
+ @connection ||= begin
12
+ connection = Bunny.new(MultipleMan.configuration.connection)
13
+ MultipleMan.logger.debug "Connecting to #{MultipleMan.configuration.connection}"
14
+ connection.start
15
+ connection
16
+ end
13
17
  end
14
18
  end
15
19
 
@@ -17,15 +21,14 @@ module MultipleMan
17
21
  channel = connection.create_channel
18
22
  yield new(channel) if block_given?
19
23
  ensure
20
- channel.close
24
+ channel.close if channel
21
25
  end
22
26
 
27
+ attr_reader :topic
28
+
23
29
  def initialize(channel)
24
30
  self.channel = channel
25
- end
26
-
27
- def topic
28
- @topic ||= channel.topic(topic_name)
31
+ self.topic = channel.topic(topic_name)
29
32
  end
30
33
 
31
34
  def topic_name
@@ -37,6 +40,7 @@ module MultipleMan
37
40
  private
38
41
 
39
42
  attr_accessor :channel
43
+ attr_writer :topic
40
44
 
41
45
  end
42
46
  end
@@ -1,3 +1,3 @@
1
1
  module MultipleMan
2
- VERSION = "0.5.7"
2
+ VERSION = "0.5.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiple_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Brunner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-05 00:00:00.000000000 Z
11
+ date: 2014-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler