bellbro 0.2.0 → 0.2.1

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: 7972910ac6f1f1bb5d63498b04dce2c62e0a40f7
4
- data.tar.gz: eb62c1ae4184d2484c814542819934dd55c2e4af
3
+ metadata.gz: eaf4bedfab71b34f1b6e366ace3d9adb8b22df2b
4
+ data.tar.gz: 4c8743c4925b0765843210d5bd52c3b06dff0a87
5
5
  SHA512:
6
- metadata.gz: 99e337067fe1357a3fba9d8776e9c65d6133f726dec8517c62d8e571fbd589c1b14fa66d989c5143d110f747e6f339ca2b6d0ceb2c0225f0b5efa659a9d6febc
7
- data.tar.gz: d4c61918923e5b993ac00a008deffee47b086ded6b0ca79e8624852e5ccd60dd98a706034f64b88bad9a512cee1592e1fa717a203fd2588695229787674c9e81
6
+ metadata.gz: d0cd386a2c657278181334bc821796d207f1d2080928eb09d95794b6150e50f6ff8c1c104c480a90c1d15f3847301035e039fde77905fdeb033d4a9456248d5c
7
+ data.tar.gz: 56000b7d618440b127cd9cb58ee700ee7a736198b9f88716c45418434871c15a2c1c81324139d3fb3623cfb1f5e55561e773c2c5ce23b32b03e30c90f5b1eeb6
@@ -15,11 +15,9 @@ module Bellbro
15
15
 
16
16
  def with_connection
17
17
  retryable(sleep: 0.5) do
18
- Sidekiq.redis do |c|
18
+ Bellbro::Settings.redis_pool.with do |c|
19
19
  c.select(model_db)
20
- val = yield c
21
- c.select(sidekiq_db)
22
- val
20
+ yield c
23
21
  end
24
22
  end
25
23
  end
@@ -27,10 +25,6 @@ module Bellbro
27
25
  def model_db
28
26
  @model_db ||= Bellbro::Settings.redis_databases[@default_db_name]
29
27
  end
30
-
31
- def sidekiq_db
32
- @sidekiq_db ||= Bellbro::Settings.redis_databases[:sidekiq]
33
- end
34
28
  end
35
29
 
36
30
  end
@@ -2,7 +2,7 @@ module Bellbro
2
2
  module Settings
3
3
 
4
4
  class SettingsData < Struct.new(
5
- :logger, :env, :redis_databases, :redis_pool_size, :redis_url
5
+ :logger, :env, :redis_databases, :redis_pool_size, :redis_url, :redis_pool
6
6
  )
7
7
  end
8
8
 
@@ -24,6 +24,15 @@ module Bellbro
24
24
  configuration.env == 'test'
25
25
  end
26
26
 
27
+ def self.redis_pool
28
+ return unless configured?
29
+ configuration.redis_pool ||= begin
30
+ ConnectionPool.new(timeout: 5, size: redis_pool_size) do
31
+ Redis.new(url: redis_url, network_timeout: 5)
32
+ end
33
+ end
34
+ end
35
+
27
36
  def self.redis_databases
28
37
  return unless configured?
29
38
  configuration.redis_databases
@@ -1,3 +1,3 @@
1
1
  module Bellbro
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bellbro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Stokes