replica_pools 2.6.1 → 2.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/replica_pools/connection_proxy.rb +9 -3
- data/lib/replica_pools/pools.rb +4 -3
- data/lib/replica_pools/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe6224f74496648e6a90578eca09d572a1a76dc354787755be545e5b1e986655
|
4
|
+
data.tar.gz: 6b38d4c3366e1e3d73081522d77c7a4ff6742d7d08fb91341efb46b4001f916b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee964bfeea8cfb1424649808d72bc606426f61d31e2310a4fbed5838de11a0731ee81a68098ec92194f938b3a4ce018e722f418bece8f6007f3437e0f335e59f
|
7
|
+
data.tar.gz: 7e5055af2da714269dfcd9ee50642438e4ec5a8b2c7036105945306bc594cee243e648478a2c979af33f9f992f956af96102903e6cd05414abe3309365a2b93e
|
@@ -33,10 +33,16 @@ module ReplicaPools
|
|
33
33
|
# this ivar is for ConnectionAdapter compatibility
|
34
34
|
# some gems (e.g. newrelic_rpm) will actually use
|
35
35
|
# instance_variable_get(:@config) to find it.
|
36
|
-
|
37
|
-
|
36
|
+
@config = current.send(ReplicaPools::ConnectionProxy.get_connection_config_method_name)
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.get_connection_config_method_name
|
40
|
+
# 6.1 supports current.connection_config
|
41
|
+
# but warns of impending deprecation in 6.2
|
42
|
+
if ActiveRecord::VERSION::STRING.to_f >= 6.1
|
43
|
+
:connection_db_config
|
38
44
|
else
|
39
|
-
|
45
|
+
:connection_config
|
40
46
|
end
|
41
47
|
end
|
42
48
|
|
data/lib/replica_pools/pools.rb
CHANGED
@@ -53,11 +53,11 @@ module ReplicaPools
|
|
53
53
|
# generates a unique ActiveRecord::Base subclass for a single replica
|
54
54
|
def connection_class(pool_name, replica_name, connection_name)
|
55
55
|
class_name = "#{pool_name.camelize}#{replica_name.camelize}"
|
56
|
-
|
56
|
+
connection_config_method_name = ReplicaPools::ConnectionProxy.get_connection_config_method_name
|
57
57
|
ReplicaPools.const_set(class_name, Class.new(ActiveRecord::Base) do |c|
|
58
58
|
c.abstract_class = true
|
59
|
-
c.define_singleton_method(
|
60
|
-
configurations.configs_for(connection_name.to_s)
|
59
|
+
c.define_singleton_method(connection_config_method_name) do
|
60
|
+
configurations.configs_for(env_name: connection_name.to_s, include_hidden: true)
|
61
61
|
end
|
62
62
|
end)
|
63
63
|
|
@@ -65,5 +65,6 @@ module ReplicaPools
|
|
65
65
|
c.establish_connection(connection_name.to_sym)
|
66
66
|
end
|
67
67
|
end
|
68
|
+
|
68
69
|
end
|
69
70
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: replica_pools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Drabik
|
8
8
|
- Lance Ivy
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-04-
|
12
|
+
date: 2023-04-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -143,7 +143,7 @@ homepage: https://github.com/kickstarter/replica_pools
|
|
143
143
|
licenses:
|
144
144
|
- MIT
|
145
145
|
metadata: {}
|
146
|
-
post_install_message:
|
146
|
+
post_install_message:
|
147
147
|
rdoc_options: []
|
148
148
|
require_paths:
|
149
149
|
- lib
|
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
159
|
version: '1.2'
|
160
160
|
requirements: []
|
161
161
|
rubygems_version: 3.1.6
|
162
|
-
signing_key:
|
162
|
+
signing_key:
|
163
163
|
specification_version: 4
|
164
164
|
summary: Connection proxy for ActiveRecord for leader / replica setups.
|
165
165
|
test_files:
|