activerecord-mysql-reconnect 0.4.2 → 0.5.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: b22787c59f28400f81aa1dc6647ecd14ceca54ecb648285ddee05e96c652c90f
4
- data.tar.gz: 0f97dc3481ca776b51390fb01ed799df7043be4e20299534726f51e75b584c88
3
+ metadata.gz: 3bc18dd788aa14cabde46f1a2bc9c64aa9168dc2b3f0dad9ad1cb46a59be5168
4
+ data.tar.gz: a0ae45dcf3eb057079a0d20d5ef782df9a346467ef4b64fc6c63afd11652b841
5
5
  SHA512:
6
- metadata.gz: d7da6b4b5ff50f35254f9bdc9f14d040cb8930d483d35b574edf1d7ec8c024ee9cc4455fdeb85589ec2c920e299bbf6d0c5cf6f896f36efb70d2fc69ec90e8e1
7
- data.tar.gz: cd45c8a2b11f9db45830da921a755dab9db9793910323c2b36f05da3c27ebdab51577e3de6d7566d9fb1a8b60b38a22ea817bf21c70b0f4a8f21a68c8559bb6d
6
+ metadata.gz: 75535a38ab352914811c427a88323dcae8eee5d62dd789550cbb156969d54fd436c22f2222b6ef0aa4ca34b705a7fe497276b89018f6edd05b704d7ebc95060d
7
+ data.tar.gz: 118a316266cf5ec6d32fc168f70b9ecd85b242be259a6351be03591d6e6f9828dd5486457eb24857ed7d2124bdffe8214e074b77e72356ab0e1571712a27cde5
@@ -2,9 +2,11 @@ dist: trusty
2
2
  sudo: required
3
3
  language: ruby
4
4
  rvm:
5
- - 2.3.6
6
- - 2.4.4
7
- - 2.5.1
5
+ - 2.3.8
6
+ - 2.4.6
7
+ - 2.5.5
8
+ - 2.6.3
9
+ - 2.7.0
8
10
  before_install:
9
11
  - docker-compose up -d
10
12
  - function mysql_ping { mysqladmin -u root -h 127.0.0.1 -ppassword ping > /dev/null 2> /dev/null; }
@@ -18,10 +20,24 @@ gemfile:
18
20
  - gemfiles/activerecord_5.0.gemfile
19
21
  - gemfiles/activerecord_5.1.gemfile
20
22
  - gemfiles/activerecord_5.2.gemfile
23
+ - gemfiles/activerecord_6.0.gemfile
24
+ - gemfiles/activerecord_master.gemfile
21
25
  env:
22
26
  matrix:
23
27
  - ACTIVERECORD_MYSQL_RECONNECT_ENGINE=InnoDB
24
28
  - ACTIVERECORD_MYSQL_RECONNECT_ENGINE=MyISAM
29
+ jobs:
30
+ exclude:
31
+ - rvm: 2.3.8
32
+ gemfile: gemfiles/activerecord_6.0.gemfile
33
+ - rvm: 2.3.8
34
+ gemfile: gemfiles/activerecord_master.gemfile
35
+ - rvm: 2.4.6
36
+ gemfile: gemfiles/activerecord_6.0.gemfile
37
+ - rvm: 2.4.6
38
+ gemfile: gemfiles/activerecord_master.gemfile
39
+ - rvm: 2.7.0
40
+ gemfile: gemfiles/activerecord_4.2.gemfile
25
41
  addons:
26
42
  apt:
27
43
  packages:
data/Appraisals CHANGED
@@ -14,3 +14,11 @@ end
14
14
  appraise "activerecord-5.2" do
15
15
  gem "activerecord", "~> 5.2.0"
16
16
  end
17
+
18
+ appraise "activerecord-6.0" do
19
+ gem "activerecord", "~> 6.0.2"
20
+ end
21
+
22
+ appraise "activerecord-master" do
23
+ gem "activerecord", git: "https://github.com/rails/rails.git"
24
+ end
data/README.md CHANGED
@@ -109,7 +109,7 @@ ene
109
109
  * `:rw` Retry in all SQL, but does not retry if `Lost connection` has happened in write SQL
110
110
  * `:force` Retry in all SQL
111
111
 
112
- ## Running tests
112
+ ## Run tests
113
113
 
114
114
  It requires the following:
115
115
 
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 6.0.2"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", git: "https://github.com/rails/rails.git"
6
+
7
+ gemspec path: "../"
@@ -1,9 +1,16 @@
1
1
  module Activerecord::Mysql::Reconnect::NewConnectionWithRetry
2
2
  def new_connection
3
- Activerecord::Mysql::Reconnect.retryable(
4
- :proc => proc { super },
5
- :connection => spec.config,
6
- )
3
+ if defined?(db_config)
4
+ Activerecord::Mysql::Reconnect.retryable(
5
+ :proc => proc { super },
6
+ :connection => db_config.configuration_hash
7
+ )
8
+ else
9
+ Activerecord::Mysql::Reconnect.retryable(
10
+ :proc => proc { super },
11
+ :connection => spec.config,
12
+ )
13
+ end
7
14
  end
8
15
  end
9
16
  class ActiveRecord::ConnectionAdapters::ConnectionPool
@@ -1,7 +1,7 @@
1
1
  module Activerecord
2
2
  module Mysql
3
3
  module Reconnect
4
- VERSION = '0.4.2'
4
+ VERSION = '0.5.0'
5
5
  end
6
6
  end
7
7
  end
@@ -461,10 +461,18 @@ describe 'activerecord-mysql-reconnect' do
461
461
 
462
462
  context "when retry failed " do
463
463
  specify do
464
- expect(ActiveRecord::Base.logger).to receive(:warn).with(warning_template % [
465
- "MySQL server has gone away. Trying to reconnect in 0.5 seconds.",
466
- "#{mysql_error}: Lost connection to MySQL server during query: SELECT `employees`.* FROM `employees` [ActiveRecord::StatementInvalid]",
467
- ])
464
+ if ActiveRecord::VERSION::MAJOR < 6
465
+ expect(ActiveRecord::Base.logger).to receive(:warn).with(warning_template % [
466
+ "MySQL server has gone away. Trying to reconnect in 0.5 seconds.",
467
+ "#{mysql_error}: Lost connection to MySQL server during query: SELECT `employees`.* FROM `employees` [ActiveRecord::StatementInvalid]",
468
+ ])
469
+ else
470
+ expect(ActiveRecord::Base.logger).to receive(:warn).with(warning_template % [
471
+ "MySQL server has gone away. Trying to reconnect in 0.5 seconds.",
472
+ "#{mysql_error}: Lost connection to MySQL server during query [ActiveRecord::StatementInvalid]",
473
+ ])
474
+ end
475
+
468
476
 
469
477
  (1.0..4.5).step(0.5).each do |sec|
470
478
  expect(ActiveRecord::Base.logger).to receive(:warn).with(warning_template % [
@@ -489,10 +497,17 @@ describe 'activerecord-mysql-reconnect' do
489
497
 
490
498
  context "when retry succeeded" do
491
499
  specify do
492
- expect(ActiveRecord::Base.logger).to receive(:warn).with(warning_template % [
493
- "MySQL server has gone away. Trying to reconnect in 0.5 seconds.",
494
- "#{mysql_error}: Lost connection to MySQL server during query: SELECT `employees`.* FROM `employees` [ActiveRecord::StatementInvalid]",
495
- ])
500
+ if ActiveRecord::VERSION::MAJOR < 6
501
+ expect(ActiveRecord::Base.logger).to receive(:warn).with(warning_template % [
502
+ "MySQL server has gone away. Trying to reconnect in 0.5 seconds.",
503
+ "#{mysql_error}: Lost connection to MySQL server during query: SELECT `employees`.* FROM `employees` [ActiveRecord::StatementInvalid]",
504
+ ])
505
+ else
506
+ expect(ActiveRecord::Base.logger).to receive(:warn).with(warning_template % [
507
+ "MySQL server has gone away. Trying to reconnect in 0.5 seconds.",
508
+ "#{mysql_error}: Lost connection to MySQL server during query [ActiveRecord::StatementInvalid]",
509
+ ])
510
+ end
496
511
 
497
512
  expect(Employee.all.length).to eq 1000
498
513
  MysqlServer.restart
@@ -47,4 +47,8 @@ RSpec.configure do |config|
47
47
  MysqlServer.reset
48
48
  ActiveRecord::Base.clear_all_connections!
49
49
  end
50
+
51
+ config.expect_with :rspec do |c|
52
+ c.max_formatted_output_length = 999999
53
+ end
50
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-mysql-reconnect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-14 00:00:00.000000000 Z
11
+ date: 2020-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -117,6 +117,8 @@ files:
117
117
  - gemfiles/activerecord_5.0.gemfile
118
118
  - gemfiles/activerecord_5.1.gemfile
119
119
  - gemfiles/activerecord_5.2.gemfile
120
+ - gemfiles/activerecord_6.0.gemfile
121
+ - gemfiles/activerecord_master.gemfile
120
122
  - lib/activerecord-mysql-reconnect.rb
121
123
  - lib/activerecord/mysql/reconnect.rb
122
124
  - lib/activerecord/mysql/reconnect/abstract_mysql_adapter_ext.rb
@@ -150,8 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
152
  - !ruby/object:Gem::Version
151
153
  version: '0'
152
154
  requirements: []
153
- rubyforge_project:
154
- rubygems_version: 2.7.6
155
+ rubygems_version: 3.0.3
155
156
  signing_key:
156
157
  specification_version: 4
157
158
  summary: It is the library to reconnect automatically when ActiveRecord is disconnected