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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 08c54937c51f30487ca6088e8e04aeb78ef91906
4
- data.tar.gz: 3c214205280bcf94ce45104cf4efb32870534e06
3
+ metadata.gz: 95fbcfe308030a2cd51631828c526ed99d50e3a0
4
+ data.tar.gz: 036bca375f7469e95621470e4a559120e83b777b
5
5
  SHA512:
6
- metadata.gz: 6a3ef6f40e944cd03510483dadb1b05f6a012693d22b5bf6e9abd1983caafb553d07bcf2d1795d269e30adc87abdd309860c4aa00f7e4282eefa93f6419c7e72
7
- data.tar.gz: e30b873276dfa9a0f9377300a893767641846ebd34788c055a0578d462b5dd44eb9c95a4944b54a4aed2972abf336756fa7a23dea2d425bbf015ca9a41ffc277
6
+ metadata.gz: 2582fd8763e7932f077fa413301f6dd0dcc13975e3cb6bbc66cafc0ebba68c30c34dd90c9287f8f8d4ca4ff8b936a18043485043cb2a40026b22b5a2684c6900
7
+ data.tar.gz: 8ae02e6061c12177868a717389e58943e5cc0b36b06f0cfeaee70786cf071a088d00c95dc87a80cb6df78b1e1360c4a110dc50394fa5bdb26ab7420c16764e29
data/lib/bellbro.rb CHANGED
@@ -12,7 +12,7 @@ require 'airbrake'
12
12
  bellbro/retryable.rb
13
13
  bellbro/ringable.rb
14
14
  bellbro/trackable.rb
15
- bellbro/redis_pool.rb
15
+ bellbro/pool.rb
16
16
  bellbro/sidekiq_utils.rb
17
17
  bellbro/bell.rb
18
18
  bellbro/service.rb
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Bellbro
2
- VERSION = "0.0.6"
2
+ VERSION = '0.0.7'
3
3
  end
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.6
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-06 00:00:00.000000000 Z
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/redis_pool.rb
140
+ - lib/bellbro/pool.rb
141
141
  - lib/bellbro/retryable.rb
142
142
  - lib/bellbro/ringable.rb
143
143
  - lib/bellbro/service.rb
@@ -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