mysql2-reconnect_with_readonly 0.1.1 → 0.2.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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/mysql2/reconnect_with_readonly.rb +8 -0
- data/lib/mysql2/reconnect_with_readonly/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c6fa8c8522ef6ce7d1df607405f27675d42fcfb
|
4
|
+
data.tar.gz: ae7c299be9f9631fa208b81dbcc3e7a2ce7839fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0e6a2d7c6c64355250b754d5034895018118b793320ac6a83d333b079cbe00abc356166a2174f3316ed619075c684bb6c50c247ebdda322723cc4f78c60c81a
|
7
|
+
data.tar.gz: a2e0eae93a51596746fc24db9d07080b0a395267962d9f168f54a772c5f0159a7d95545a9bef077b87dde027e9bb2af19d1d48775bda858c7c0193031afe8d9c
|
data/CHANGELOG.md
CHANGED
@@ -65,11 +65,19 @@ module Mysql2
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
+
Mysql2::ReconnectWithReadonly::OriginalClient.constants.each do |const|
|
69
|
+
const_set(const, Mysql2::ReconnectWithReadonly::OriginalClient.const_get(const))
|
70
|
+
end
|
71
|
+
|
68
72
|
def initialize(opts = {})
|
69
73
|
@opts = opts
|
70
74
|
@original_client = Mysql2::ReconnectWithReadonly::OriginalClient.new(@opts)
|
71
75
|
end
|
72
76
|
|
77
|
+
# Mysql2::Client does not have a #reconnect method
|
78
|
+
# Mysql2::Client#close and Mysql2::Client#connect(*args) resulted in SEGV.
|
79
|
+
# It is required to create a new Mysql2::Client instance for reconnection.
|
80
|
+
# This is why we wrap orginal client with this monkey pathced client.
|
73
81
|
def reconnect
|
74
82
|
@original_client.close rescue nil
|
75
83
|
@original_client = Mysql2::ReconnectWithReadonly::OriginalClient.new(@opts)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mysql2-reconnect_with_readonly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mysql2
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.5.
|
98
|
+
rubygems_version: 2.5.2
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: Reconnect mysql2 if the MySQL server is running with the --read-only option.
|