replica_pools 2.1.3 → 2.2.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a65839a4e55ab8f54a0c58a84ce6f36aff3c7f21
4
- data.tar.gz: 82d711298a69f81da31b2557412ad2ec17efaf7d
2
+ SHA256:
3
+ metadata.gz: aba6d5a57bda0c33f6531172ff1f8a9e735168a94688318c09388032063ca637
4
+ data.tar.gz: 10677ab3c419b42fa1a8ebe8367204a42ff87bbdc01a1a986575a70f12cb3925
5
5
  SHA512:
6
- metadata.gz: f7d70729b702cc1a23b5103e12b5fe048fe064d1deae02a0ab822b678934cf2b7982aca1edd41db2ed8aa55a5db5cb0e21518e0e380863915c721b6be43336a3
7
- data.tar.gz: 1377e2d4ded4c12ab215d7e2841349da404a30578905c5653f3f8c89292f856fae8d52161a60209ff959018bfea47e6d55f9582cce1301eaf345b7bc0faacd3a
6
+ metadata.gz: 3c0bd1e057eb02a547d33792d8d3bbc7b378c7cc49574a8635a885c0ce9668fe90c1dc880435a0a3eabd8d3322d5f89970c1809b0d8c98ddbe538289232c7b61
7
+ data.tar.gz: 42b3bc14c121185c8df5c7de20c556d3604576878ea6f3deaddf9e8ad1a0b726e99c12f23bbb1ca9d104e757dc18d04f3848c3bf86304a49efa54b3ae259dc63
@@ -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 == 5
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,
@@ -27,12 +27,22 @@ module ReplicaPools
27
27
 
28
28
  # finds valid pool configs
29
29
  def pool_configurations
30
- ActiveRecord::Base.configurations.map do |name, config|
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}"
@@ -1,3 +1,3 @@
1
1
  module ReplicaPools
2
- VERSION = "2.1.3"
2
+ VERSION = "2.2.0.beta1"
3
3
  end
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.1.3
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-01-17 00:00:00.000000000 Z
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
- rubyforge_project:
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.