bellbro 0.0.6 → 0.0.7
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 +4 -4
- data/lib/bellbro.rb +1 -1
- data/lib/bellbro/pool.rb +24 -0
- data/lib/bellbro/settings.rb +6 -1
- data/lib/bellbro/version.rb +1 -1
- metadata +3 -3
- data/lib/bellbro/redis_pool.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95fbcfe308030a2cd51631828c526ed99d50e3a0
|
4
|
+
data.tar.gz: 036bca375f7469e95621470e4a559120e83b777b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2582fd8763e7932f077fa413301f6dd0dcc13975e3cb6bbc66cafc0ebba68c30c34dd90c9287f8f8d4ca4ff8b936a18043485043cb2a40026b22b5a2684c6900
|
7
|
+
data.tar.gz: 8ae02e6061c12177868a717389e58943e5cc0b36b06f0cfeaee70786cf071a088d00c95dc87a80cb6df78b1e1360c4a110dc50394fa5bdb26ab7420c16764e29
|
data/lib/bellbro.rb
CHANGED
data/lib/bellbro/pool.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Bellbro
|
2
|
+
module Pool
|
3
|
+
def self.included(klass)
|
4
|
+
klass.extend(self)
|
5
|
+
|
6
|
+
class << klass
|
7
|
+
def pool(pool_name)
|
8
|
+
@pool_name = pool_name
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def with_connection(pool_name: nil, &block)
|
14
|
+
retryable(sleep: 0.5) do
|
15
|
+
connection_pool(pool_name: pool_name).with &block
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def connection_pool(pool_name: nil)
|
20
|
+
Bellbro::Settings.connection_pools[pool_name || @pool_name]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/lib/bellbro/settings.rb
CHANGED
@@ -2,7 +2,7 @@ module Bellbro
|
|
2
2
|
module Settings
|
3
3
|
|
4
4
|
class SettingsData < Struct.new(
|
5
|
-
:logger, :env
|
5
|
+
:logger, :env, :connection_pools
|
6
6
|
)
|
7
7
|
end
|
8
8
|
|
@@ -21,6 +21,11 @@ module Bellbro
|
|
21
21
|
$bellbro_configuration.env == 'test'
|
22
22
|
end
|
23
23
|
|
24
|
+
def self.connection_pools
|
25
|
+
return unless configured?
|
26
|
+
$bellbro_configuration.connection_pools
|
27
|
+
end
|
28
|
+
|
24
29
|
def self.logger
|
25
30
|
return unless configured?
|
26
31
|
$bellbro_configuration.logger
|
data/lib/bellbro/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bellbro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Stokes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,7 +137,7 @@ files:
|
|
137
137
|
- bellbro.gemspec
|
138
138
|
- lib/bellbro.rb
|
139
139
|
- lib/bellbro/bell.rb
|
140
|
-
- lib/bellbro/
|
140
|
+
- lib/bellbro/pool.rb
|
141
141
|
- lib/bellbro/retryable.rb
|
142
142
|
- lib/bellbro/ringable.rb
|
143
143
|
- lib/bellbro/service.rb
|
data/lib/bellbro/redis_pool.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
module Bellbro
|
2
|
-
module Pool
|
3
|
-
def self.included(klass)
|
4
|
-
klass.extend(self)
|
5
|
-
|
6
|
-
class << klass
|
7
|
-
def pool(conn_pool)
|
8
|
-
self.class_eval do
|
9
|
-
@connection_pool = conn_pool
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def with_connection(&block)
|
16
|
-
retryable(sleep: 0.5) do
|
17
|
-
connection_pool.with &block
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def connection_pool
|
22
|
-
@connection_pool
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|