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 +4 -4
- data/lib/bellbro/redis_pool.rb +2 -8
- data/lib/bellbro/settings.rb +10 -1
- data/lib/bellbro/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eaf4bedfab71b34f1b6e366ace3d9adb8b22df2b
|
4
|
+
data.tar.gz: 4c8743c4925b0765843210d5bd52c3b06dff0a87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0cd386a2c657278181334bc821796d207f1d2080928eb09d95794b6150e50f6ff8c1c104c480a90c1d15f3847301035e039fde77905fdeb033d4a9456248d5c
|
7
|
+
data.tar.gz: 56000b7d618440b127cd9cb58ee700ee7a736198b9f88716c45418434871c15a2c1c81324139d3fb3623cfb1f5e55561e773c2c5ce23b32b03e30c90f5b1eeb6
|
data/lib/bellbro/redis_pool.rb
CHANGED
@@ -15,11 +15,9 @@ module Bellbro
|
|
15
15
|
|
16
16
|
def with_connection
|
17
17
|
retryable(sleep: 0.5) do
|
18
|
-
|
18
|
+
Bellbro::Settings.redis_pool.with do |c|
|
19
19
|
c.select(model_db)
|
20
|
-
|
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
|
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, :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
|
data/lib/bellbro/version.rb
CHANGED