activerecord-mysql-reconnect 0.3.5 → 0.3.6

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
2
  SHA1:
3
- metadata.gz: ae0956c41a7eeb006c0eb44216a288db43d76d4e
4
- data.tar.gz: f14f9a4216ce0bbe51dcb9d04040082915520eda
3
+ metadata.gz: aa9520e56f0c5726a4abb72bd8bdc719e94d709f
4
+ data.tar.gz: fb4302265396c109b2be9f328be48aa4f4351b35
5
5
  SHA512:
6
- metadata.gz: 296b46697e351bce23eaf245777683d4cc25bd6ea273b4481bab4165a747a6b3daed6723a999aa74bd8f89a01d44ef648dfa76cbe44640c15dc506846d6eede1
7
- data.tar.gz: ad5d74f3fd662d64d1abd98ff57b6948da3c8758623c8f1782e575c50d70258e54b9941f7e29ab98fc48f535c5688a194571564139ef0872fe5dcd40c6aa7574
6
+ metadata.gz: 7ab2e9a0f7aed38b65408fa5f9c7077047617c5c9275c753c9f6fd195cf4ef37708622bf8165be4a77d347694085e3cecc925e2db95aa6a986b2ff1ab181f6d3
7
+ data.tar.gz: bce551e66baf1dd0a6e6717d15d2a53206d05c1698602ab6921375ab6b18082d3c85fcf4f540099a53508d1444ab643ba617dba4175dd1d495c66b3e58813dd7
@@ -42,6 +42,7 @@ module Activerecord::Mysql::Reconnect
42
42
  'The MySQL server is running with the --read-only option',
43
43
  "Can't connect to local MySQL server", # When running in local sandbox, or using a socket file
44
44
  'Unknown MySQL server host', # For DNS blips
45
+ "Lost connection to MySQL server at 'reading initial communication packet'",
45
46
  ]
46
47
 
47
48
  HANDLE_ERROR_MESSAGES = HANDLE_R_ERROR_MESSAGES + HANDLE_RW_ERROR_MESSAGES
@@ -1,7 +1,7 @@
1
1
  module Activerecord
2
2
  module Mysql
3
3
  module Reconnect
4
- VERSION = '0.3.5'
4
+ VERSION = '0.3.6'
5
5
  end
6
6
  end
7
7
  end
@@ -54,6 +54,73 @@ describe 'activerecord-mysql-reconnect' do
54
54
  }.to_not raise_error
55
55
  end
56
56
 
57
+ [
58
+ 'MySQL server has gone away',
59
+ 'Server shutdown in progress',
60
+ 'closed MySQL connection',
61
+ "Can't connect to MySQL server",
62
+ 'Query execution was interrupted',
63
+ 'Access denied for user',
64
+ 'The MySQL server is running with the --read-only option',
65
+ "Can't connect to local MySQL server", # When running in local sandbox, or using a socket file
66
+ 'Unknown MySQL server host', # For DNS blips
67
+ "Lost connection to MySQL server at 'reading initial communication packet'",
68
+ ].each do |errmsg|
69
+ it "on error: #{errmsg}" do
70
+ expect {
71
+ th = thread_run {|do_stop|
72
+ emp = nil
73
+
74
+ mysql2_error("x#{errmsg}x") do
75
+ emp = Employee.create(
76
+ :emp_no => 1,
77
+ :birth_date => Time.now,
78
+ :first_name => "' + sleep(10) + '",
79
+ :last_name => 'Tiger',
80
+ :hire_date => Time.now
81
+ )
82
+ end
83
+
84
+ do_stop.call
85
+
86
+ expect(emp.id).to eq(300025)
87
+ expect(emp.emp_no).to eq(1)
88
+ }
89
+
90
+ mysql_restart
91
+ expect(Employee.count).to be >= 300024
92
+ th.join
93
+ }.to_not raise_error
94
+ end
95
+ end
96
+
97
+ it "on unhandled error" do
98
+ expect {
99
+ th = thread_run {|do_stop|
100
+ emp = nil
101
+
102
+ mysql2_error("unhandled error") do
103
+ emp = Employee.create(
104
+ :emp_no => 1,
105
+ :birth_date => Time.now,
106
+ :first_name => "' + sleep(10) + '",
107
+ :last_name => 'Tiger',
108
+ :hire_date => Time.now
109
+ )
110
+ end
111
+
112
+ do_stop.call
113
+
114
+ expect(emp.id).to eq(300025)
115
+ expect(emp.emp_no).to eq(1)
116
+ }
117
+
118
+ mysql_restart
119
+ expect(Employee.count).to be >= 300024
120
+ th.join
121
+ }.to raise_error
122
+ end
123
+
57
124
  it 'op update' do
58
125
  expect {
59
126
  th = thread_run {|do_stop|
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.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-05 00:00:00.000000000 Z
11
+ date: 2014-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord