replica_pools 2.1.3 → 2.2.0.beta1
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 +5 -5
- data/lib/replica_pools/engine.rb +1 -1
- data/lib/replica_pools/pools.rb +11 -1
- data/lib/replica_pools/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: aba6d5a57bda0c33f6531172ff1f8a9e735168a94688318c09388032063ca637
|
|
4
|
+
data.tar.gz: 10677ab3c419b42fa1a8ebe8367204a42ff87bbdc01a1a986575a70f12cb3925
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c0bd1e057eb02a547d33792d8d3bbc7b378c7cc49574a8635a885c0ce9668fe90c1dc880435a0a3eabd8d3322d5f89970c1809b0d8c98ddbe538289232c7b61
|
|
7
|
+
data.tar.gz: 42b3bc14c121185c8df5c7de20c556d3604576878ea6f3deaddf9e8ad1a0b726e99c12f23bbb1ca9d104e757dc18d04f3848c3bf86304a49efa54b3ae259dc63
|
data/lib/replica_pools/engine.rb
CHANGED
|
@@ -21,7 +21,7 @@ module ReplicaPools
|
|
|
21
21
|
:select_rows, :select, :verify!, :raw_connection, :active?, :reconnect!,
|
|
22
22
|
:disconnect!, :reset_runtime, :log
|
|
23
23
|
]
|
|
24
|
-
elsif ActiveRecord::VERSION::MAJOR
|
|
24
|
+
elsif [5, 6].include?(ActiveRecord::VERSION::MAJOR)
|
|
25
25
|
[
|
|
26
26
|
:select_all, :select_one, :select_value, :select_values,
|
|
27
27
|
:select_rows, :select, :select_prepared, :verify!, :raw_connection,
|
data/lib/replica_pools/pools.rb
CHANGED
|
@@ -27,12 +27,22 @@ module ReplicaPools
|
|
|
27
27
|
|
|
28
28
|
# finds valid pool configs
|
|
29
29
|
def pool_configurations
|
|
30
|
-
|
|
30
|
+
config_hash.map do |name, config|
|
|
31
31
|
next unless name.to_s =~ /#{ReplicaPools.config.environment}_pool_(.*)_name_(.*)/
|
|
32
32
|
[name, $1, $2]
|
|
33
33
|
end.compact
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
def config_hash
|
|
37
|
+
if ActiveRecord::VERSION::MAJOR >= 6
|
|
38
|
+
# in Rails >= 6, `configurations` is an instance of ActiveRecord::DatabaseConfigurations
|
|
39
|
+
ActiveRecord::Base.configurations.to_h
|
|
40
|
+
else
|
|
41
|
+
# in Rails < 6, it's just a hash
|
|
42
|
+
ActiveRecord::Base.configurations
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
36
46
|
# generates a unique ActiveRecord::Base subclass for a single replica
|
|
37
47
|
def connection_class(pool_name, replica_name, connection_name)
|
|
38
48
|
class_name = "#{pool_name.camelize}#{replica_name.camelize}"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: replica_pools
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.2.0.beta1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dan Drabik
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2019-
|
|
12
|
+
date: 2019-08-05 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activerecord
|
|
@@ -138,8 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
138
138
|
- !ruby/object:Gem::Version
|
|
139
139
|
version: '1.2'
|
|
140
140
|
requirements: []
|
|
141
|
-
|
|
142
|
-
rubygems_version: 2.4.5.1
|
|
141
|
+
rubygems_version: 3.0.3
|
|
143
142
|
signing_key:
|
|
144
143
|
specification_version: 4
|
|
145
144
|
summary: Connection proxy for ActiveRecord for leader / replica setups.
|