replica_pools 2.6.1 → 2.6.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da0145ee587f2856d0ba448914437caf148e8825abc9e2b31a853e8c6585ffdb
4
- data.tar.gz: 26ffb29f8c44dcaefa6f0ba16452ab4af4757c46e1f660d76f6e3906cc2edb06
3
+ metadata.gz: e01d82e28f2d89abe76f89d880196de84b563e9b08401d94867828b5368a164d
4
+ data.tar.gz: cf5aa2ea0c91abaa27cd7fb2fdc99dbcd327188f3427572c8add0f13930cdf97
5
5
  SHA512:
6
- metadata.gz: 70883d9c60ccfc07230b262af71c476d2944321e371a6bbdc4ba873eefe17e49e9185ac1bae7a95b30f51f6874b2a8d313fe2b35dc3b9c3253918b590d8a5798
7
- data.tar.gz: c47b4975d6bbc30e44602ed51a60ea9d827624b3dabf726ad54d21524691e8acbf78545d7b1afecf5322d5122fce2a908b0461a68f6411a0f16e058354356c64
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
- if ActiveRecord::VERSION::MAJOR >= 7
37
- @config = current.connection_db_config
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
- @config = current.connection_config
45
+ :connection_config
40
46
  end
41
47
  end
42
48
 
@@ -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(:connection_config) do
60
- configurations.configs_for(connection_name.to_s)
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
@@ -1,3 +1,3 @@
1
1
  module ReplicaPools
2
- VERSION = "2.6.1"
2
+ VERSION = "2.6.3"
3
3
  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.1
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-04-13 00:00:00.000000000 Z
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.1.6
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