replica_pools 2.6.1 → 2.6.3
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 +8 -3
- data/lib/replica_pools/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e01d82e28f2d89abe76f89d880196de84b563e9b08401d94867828b5368a164d
|
4
|
+
data.tar.gz: cf5aa2ea0c91abaa27cd7fb2fdc99dbcd327188f3427572c8add0f13930cdf97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb6791fcbac25902d48092c5c6faa1cd60753419003ff9b3c957bce185e0c27fd9ec0db59653667bad7dee2247a242c232a4f30ebcbc67694d0657c4c16e25c8
|
7
|
+
data.tar.gz: ea3f61c5f4499437f74a28b81cddef31000c5d8323e81e53ebccef6d3d7d8501fd5537b469cc29a5c67a2c8bc58bec3057cde6ddef132ef17af53e50b966ccaf
|
@@ -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,15 @@ 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
|
-
|
59
|
+
c.define_singleton_method(connection_config_method_name) do
|
60
|
+
if ActiveRecord::VERSION::MAJOR == 6
|
61
|
+
configurations.configs_for(env_name: connection_name.to_s, include_replicas: true)
|
62
|
+
elsif ActiveRecord::VERSION::MAJOR == 7
|
63
|
+
configurations.configs_for(env_name: connection_name.to_s, include_hidden: true)
|
64
|
+
end
|
61
65
|
end
|
62
66
|
end)
|
63
67
|
|
@@ -65,5 +69,6 @@ module ReplicaPools
|
|
65
69
|
c.establish_connection(connection_name.to_sym)
|
66
70
|
end
|
67
71
|
end
|
72
|
+
|
68
73
|
end
|
69
74
|
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.3
|
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-
|
12
|
+
date: 2023-06-28 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
|
@@ -158,14 +158,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '1.2'
|
160
160
|
requirements: []
|
161
|
-
rubygems_version: 3.
|
162
|
-
signing_key:
|
161
|
+
rubygems_version: 3.2.33
|
162
|
+
signing_key:
|
163
163
|
specification_version: 4
|
164
164
|
summary: Connection proxy for ActiveRecord for leader / replica setups.
|
165
165
|
test_files:
|
166
|
-
- spec/spec_helper.rb
|
167
|
-
- spec/pool_spec.rb
|
168
|
-
- spec/slave_pools_spec.rb
|
169
166
|
- spec/config/test_model.rb
|
170
|
-
- spec/query_cache_spec.rb
|
171
167
|
- spec/connection_proxy_spec.rb
|
168
|
+
- spec/pool_spec.rb
|
169
|
+
- spec/query_cache_spec.rb
|
170
|
+
- spec/slave_pools_spec.rb
|
171
|
+
- spec/spec_helper.rb
|