replica_pools 2.6.2 → 2.6.4
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 +4 -1
- data/lib/replica_pools/pools.rb +5 -1
- data/lib/replica_pools/version.rb +1 -1
- data/spec/spec_helper.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: fec69b8b572b701e6f50e555c91b38d9c166ee9ff2b1f9e1afff6b925483d224
|
4
|
+
data.tar.gz: 3be5fab5ae1aeb1609ac669fa85da3b0741b4eaa9f8066575b5f17c04d991590
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 507f274afcd27011fa4e40de581d59914423bfa3ff98398dcc744a56affe781b88d4aeecd3c22ca88419ef73752792fa25b791692d1f2d0b999c270509e68560
|
7
|
+
data.tar.gz: 5917987630ff6f7b2703223674df73590d3f60f54ea9e054966db3a4a30a5a3eaa063c785811bc97da45a55eff4d234e537ed7fc5505462f0eed2ede823fdec2
|
@@ -109,7 +109,10 @@ module ReplicaPools
|
|
109
109
|
|
110
110
|
def route_to(conn, method, *args, **keyword_args, &block)
|
111
111
|
raise ReplicaPools::LeaderDisabled.new if ReplicaPools.config.disable_leader && conn == leader
|
112
|
-
conn.retrieve_connection
|
112
|
+
connection = conn.retrieve_connection
|
113
|
+
|
114
|
+
connection.verify!
|
115
|
+
connection.send(method, *args, **keyword_args, &block)
|
113
116
|
rescue => e
|
114
117
|
ReplicaPools.log :error, "Error during ##{method}: #{e}"
|
115
118
|
log_proxy_state
|
data/lib/replica_pools/pools.rb
CHANGED
@@ -57,7 +57,11 @@ module ReplicaPools
|
|
57
57
|
ReplicaPools.const_set(class_name, Class.new(ActiveRecord::Base) do |c|
|
58
58
|
c.abstract_class = true
|
59
59
|
c.define_singleton_method(connection_config_method_name) do
|
60
|
-
|
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
|
|
data/spec/spec_helper.rb
CHANGED
@@ -11,7 +11,7 @@ end
|
|
11
11
|
require 'active_record'
|
12
12
|
spec_dir = File.dirname(__FILE__)
|
13
13
|
ActiveRecord::Base.logger = Logger.new(spec_dir + "/debug.log")
|
14
|
-
ActiveRecord::Base.configurations = YAML::
|
14
|
+
ActiveRecord::Base.configurations = YAML::safe_load(ERB.new(File.read(spec_dir + '/config/database.yml')).result, aliases: true)
|
15
15
|
ActiveRecord::Base.establish_connection :test
|
16
16
|
ActiveRecord::Migration.verbose = false
|
17
17
|
ActiveRecord::Migration.create_table(:test_models, :force => true) {}
|
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.4
|
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-10-05 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:
|