multiple_man 0.5.7 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/multiple_man/connection.rb +14 -10
- data/lib/multiple_man/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14b664ec408ce39903e299ff4be21513e3925014
|
4
|
+
data.tar.gz: 00b8579e4aeaa8e8697e5fa963646aef68757377
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
@
|
9
|
-
connection
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
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
|
data/lib/multiple_man/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2014-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|