active_record_host_pool 0.11.0 → 0.12.0

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: '018bdc07dc5428ae890589b96fbf3748d46ef5abc2625c61278ac50ffa079923'
4
- data.tar.gz: 101a032eba4e5628106fd4ae8a83c66f52bb68d89f0baad5180ec41c83a932ab
3
+ metadata.gz: 902e5e0cb2f51303355efa11fe7d25d357d6c9560310cab1e3e6bc5c0ad1758b
4
+ data.tar.gz: 9584c62c0572915b4de0aff99b2449a787c6236d3828e3858b6a6c2079ef1882
5
5
  SHA512:
6
- metadata.gz: 1ea8bf1c7704be6d72c97be06dfc084a2a66aa0e64848fcabcbbbcb6c73b360517f9737eac8d0e6459e8b6c85d236d36ea7f2a8bf8ed697a46c9d2eb0eca5d3a
7
- data.tar.gz: 6eeb13fbd13582106e01bd8fc8a560eeef690d4c375926d17ebccae96b385ca8d4d3e2a75372fc99efad09e7e1bc90e06fc4417d21b3e5deada1ee940f8e347a
6
+ metadata.gz: 400906a1082b28c51d7bbcd3efffed956e4e26ce46c8bc2e71a73431ce1028eafcbfef06a0b3a220647ea3e5865b1d9ac8b2dd34960bba76d7ca059339daaf0a
7
+ data.tar.gz: 8094cbe8a0497f5d16cb7caa27953d4e78e2945cd46f53e00912654b2fff7cb447c8dc323b0faeebc74f3c425bd9e6a2b86f4546485e46171616a3cd2b6f10e3
data/Readme.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Build Status](https://travis-ci.org/zendesk/active_record_host_pool.svg?branch=master)](https://travis-ci.org/zendesk/active_record_host_pool)
1
+ [![Build status](https://circleci.com/gh/zendesk/active_record_host_pool.svg?style=svg)](https://circleci.com/gh/zendesk/active_record_host_pool)
2
2
 
3
3
  # ActiveRecord host pooling
4
4
 
@@ -17,11 +17,11 @@ Postgres, from an informal reading of the docs, will never support the concept o
17
17
  and make sure to require 'active\_record\_host\_pool' in some way.
18
18
 
19
19
  ## Testing
20
- You need a local user called 'travis'.
20
+ You need a local user called 'john-doe'.
21
21
 
22
22
  mysql -uroot
23
- CREATE USER 'travis'@'localhost';
24
- GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX ON *.* TO 'travis'@'localhost';
23
+ CREATE USER 'john-doe'@'localhost';
24
+ GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX ON *.* TO 'john-doe'@'localhost';
25
25
  FLUSH PRIVILEGES;
26
26
 
27
27
  ## Copyright
@@ -90,9 +90,7 @@ module ActiveRecord
90
90
  class ConnectionHandler
91
91
  if ActiveRecord::VERSION::MAJOR == 5
92
92
  if ActiveRecord::VERSION::MINOR == 0
93
- def establish_connection(spec)
94
- owner_to_pool[spec.name] = ActiveRecordHostPool::PoolProxy.new(spec)
95
- end
93
+ raise "Unsupported version of Rails (v#{ActiveRecord::VERSION::STRING})"
96
94
  else
97
95
  def establish_connection(spec)
98
96
  resolver = ConnectionAdapters::ConnectionSpecification::Resolver.new(Base.configurations)
@@ -107,21 +105,13 @@ module ActiveRecord
107
105
  def establish_connection(owner, spec)
108
106
  @class_to_pool.clear
109
107
  raise "Anonymous class is not allowed." unless owner.name
110
- owner_to_pool[owner.name] = ActiveRecordHostPool::PoolProxy.new(spec)
111
- end
112
108
 
113
- elsif ActiveRecord::VERSION::MAJOR == 3
114
-
115
- def establish_connection(owner, spec)
116
- @connection_pools[spec] ||= ActiveRecordHostPool::PoolProxy.new(spec)
117
- @class_to_pool[owner] = @connection_pools[spec]
109
+ owner_to_pool[owner.name] = ActiveRecordHostPool::PoolProxy.new(spec)
118
110
  end
119
111
 
120
112
  else
121
113
 
122
- def establish_connection(owner, spec)
123
- @connection_pools[owner] = ActiveRecordHostPool::PoolProxy.new(spec)
124
- end
114
+ raise "Unsupported version of Rails (v#{ActiveRecord::VERSION::STRING})"
125
115
  end
126
116
  end
127
117
  end
@@ -66,6 +66,7 @@ module ActiveRecordHostPool
66
66
  def disconnect!
67
67
  p = _connection_pool(false)
68
68
  return unless p
69
+
69
70
  p.disconnect!
70
71
  p.automatic_reconnect = true if p.respond_to?(:automatic_reconnect=)
71
72
  _clear_connection_proxy_cache
@@ -74,6 +75,7 @@ module ActiveRecordHostPool
74
75
  def automatic_reconnect=(value)
75
76
  p = _connection_pool(false)
76
77
  return unless p
78
+
77
79
  p.automatic_reconnect = value if p.respond_to?(:automatic_reconnect=)
78
80
  end
79
81
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordHostPool
4
- VERSION = "0.11.0"
4
+ VERSION = "0.12.0"
5
5
  end
@@ -52,7 +52,7 @@ test_host_2_db_5:
52
52
  adapter: mysql2
53
53
  encoding: utf8
54
54
  database: arhp_test_4
55
- username: travis
55
+ username: john-doe
56
56
  password:
57
57
  host: <%= mysql.host %>
58
58
  port: <%= mysql.port %>
@@ -15,14 +15,15 @@ Minitest::Test = MiniTest::Unit::TestCase unless defined?(::Minitest::Test)
15
15
  ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/test.log')
16
16
 
17
17
  Phenix.configure do |config|
18
- config.skip_database = ->(name, conf) { name =~ /not_there/ || conf['username'] == 'travis' }
18
+ config.skip_database = ->(name, conf) { name =~ /not_there/ || conf['username'] == 'john-doe' }
19
19
  end
20
20
 
21
21
  module ARHPTestSetup
22
22
  private
23
23
 
24
24
  def arhp_create_models
25
- return if Object.const_defined?('Test1')
25
+ return if ARHPTestSetup.const_defined?('Test1')
26
+
26
27
  eval <<-RUBY
27
28
  class Test1 < ActiveRecord::Base
28
29
  self.table_name = "tests"
@@ -150,7 +150,7 @@ class ActiveRecordHostPoolTest < Minitest::Test
150
150
 
151
151
  def assert_action_uses_correct_database(action, sql)
152
152
  (1..4).each do |i|
153
- klass = eval "Test#{i}"
153
+ klass = ARHPTestSetup.const_get("Test#{i}")
154
154
  desired_db = "arhp_test_#{i}"
155
155
  klass.connection.send(action, sql)
156
156
  assert_equal desired_db, current_database(klass)
metadata CHANGED
@@ -1,14 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_host_pool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
+ - Benjamin Quorning
8
+ - Gabe Martin-Dempesy
9
+ - Pierre Schambacher
7
10
  - Ben Osheroff
8
11
  autorequire:
9
12
  bindir: bin
10
13
  cert_chain: []
11
- date: 2018-04-24 00:00:00.000000000 Z
14
+ date: 2019-08-21 00:00:00.000000000 Z
12
15
  dependencies:
13
16
  - !ruby/object:Gem::Dependency
14
17
  name: activerecord
@@ -16,7 +19,7 @@ dependencies:
16
19
  requirements:
17
20
  - - ">="
18
21
  - !ruby/object:Gem::Version
19
- version: 3.2.0
22
+ version: 4.2.0
20
23
  - - "<"
21
24
  - !ruby/object:Gem::Version
22
25
  version: '6.0'
@@ -26,7 +29,7 @@ dependencies:
26
29
  requirements:
27
30
  - - ">="
28
31
  - !ruby/object:Gem::Version
29
- version: 3.2.0
32
+ version: 4.2.0
30
33
  - - "<"
31
34
  - !ruby/object:Gem::Version
32
35
  version: '6.0'
@@ -104,16 +107,16 @@ dependencies:
104
107
  name: rubocop
105
108
  requirement: !ruby/object:Gem::Requirement
106
109
  requirements:
107
- - - ">="
110
+ - - "~>"
108
111
  - !ruby/object:Gem::Version
109
- version: 0.55.0
112
+ version: 0.62.0
110
113
  type: :development
111
114
  prerelease: false
112
115
  version_requirements: !ruby/object:Gem::Requirement
113
116
  requirements:
114
- - - ">="
117
+ - - "~>"
115
118
  - !ruby/object:Gem::Version
116
- version: 0.55.0
119
+ version: 0.62.0
117
120
  - !ruby/object:Gem::Dependency
118
121
  name: shoulda
119
122
  requirement: !ruby/object:Gem::Requirement
@@ -128,23 +131,11 @@ dependencies:
128
131
  - - ">="
129
132
  - !ruby/object:Gem::Version
130
133
  version: '0'
131
- - !ruby/object:Gem::Dependency
132
- name: wwtd
133
- requirement: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - ">="
136
- - !ruby/object:Gem::Version
137
- version: '0'
138
- type: :development
139
- prerelease: false
140
- version_requirements: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - ">="
143
- - !ruby/object:Gem::Version
144
- version: '0'
145
134
  description: ''
146
135
  email:
147
- - ben@gimbo.net
136
+ - bquorning@zendesk.com
137
+ - gabe@zendesk.com
138
+ - pschambacher@zendesk.com
148
139
  executables: []
149
140
  extensions: []
150
141
  extra_rdoc_files:
@@ -181,8 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
181
172
  - !ruby/object:Gem::Version
182
173
  version: '0'
183
174
  requirements: []
184
- rubyforge_project:
185
- rubygems_version: 2.7.6
175
+ rubygems_version: 3.0.3
186
176
  signing_key:
187
177
  specification_version: 4
188
178
  summary: Allow ActiveRecord to share a connection to multiple databases on the same