fibered_mysql2 0.2.0.pre.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +3 -3
- data/.ruby-version +1 -1
- data/Appraisals +2 -6
- data/CHANGELOG.md +9 -0
- data/Gemfile +6 -6
- data/Gemfile.lock +147 -128
- data/gemfiles/.bundle/config +2 -0
- data/gemfiles/{rails_6.gemfile → rails_6_0.gemfile} +6 -5
- data/gemfiles/{rails_5.gemfile → rails_6_1.gemfile} +7 -6
- data/lib/active_record/connection_adapters/fibered_mysql2_adapter.rb +1 -7
- data/lib/fibered_mysql2/fibered_database_connection_pool.rb +6 -2
- data/lib/fibered_mysql2/fibered_mysql2_connection_factory.rb +57 -3
- data/lib/fibered_mysql2/hash_config_override.rb +14 -0
- data/lib/fibered_mysql2/version.rb +1 -1
- data/lib/fibered_mysql2.rb +1 -0
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e44e8e3a3b531c9fe568f4d0fcbd19dea85b92e0fc391ca9e50c898b0119359
|
4
|
+
data.tar.gz: e41214cb8676608ed5ec6a22dbabea0dfa6d02d41e5ec3a78be4ce0057e76817
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d55a57ce410ccbbbe0c31c08e8dce4f3115ad175ac71cd9747d2072a9771c068c43bfbc05c374631e1f80484619a3adfcee98cfe00eb57fe6458204c538d285
|
7
|
+
data.tar.gz: 3301cac13fa5c7c2140660e3282f50c06ad3d3bac53a1afe02be328eb5d9e7580e4441e413993fe060a8c1db49d3884c8beafd0295d0dbdc95b9e0113ba1b680
|
data/.github/workflows/build.yml
CHANGED
@@ -8,11 +8,11 @@ jobs:
|
|
8
8
|
strategy:
|
9
9
|
fail-fast: false
|
10
10
|
matrix:
|
11
|
-
ruby: [
|
11
|
+
ruby: [3.1, 3.2, 3.3]
|
12
12
|
gemfile:
|
13
13
|
- Gemfile
|
14
|
-
- gemfiles/
|
15
|
-
- gemfiles/
|
14
|
+
- gemfiles/rails_6_0.gemfile
|
15
|
+
- gemfiles/rails_6_1.gemfile
|
16
16
|
env:
|
17
17
|
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
18
18
|
steps:
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.1.6
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,14 @@ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
5
5
|
Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [0.2.1] - 2024-08-19
|
8
|
+
### Fixed
|
9
|
+
- Fixed bugs in Rails 6.1.
|
10
|
+
|
11
|
+
## [0.2.0] - 2023-01-12
|
12
|
+
### Added
|
13
|
+
- Added support for Rails 6+ by adding knowledge of lazy transactions to the adapter.
|
14
|
+
|
7
15
|
## [0.1.5] - 2022-03-25
|
8
16
|
### Changed
|
9
17
|
- Upgraded Bundler to 2.2.29 and Ruby to 2.7.5. Removed support for Rails 4.
|
@@ -37,6 +45,7 @@ threaded, not fibered.
|
|
37
45
|
- Added TravisCI unit test pipeline.
|
38
46
|
- Added coverage reports via Coveralls.
|
39
47
|
|
48
|
+
[0.2.0]: https://github.com/Invoca/fibered_mysql2/compare/v0.1.5..v0.2.0
|
40
49
|
[0.1.5]: https://github.com/Invoca/fibered_mysql2/compare/v0.1.4..v0.1.5
|
41
50
|
[0.1.4]: https://github.com/Invoca/fibered_mysql2/compare/v0.1.3..v0.1.4
|
42
51
|
[0.1.3]: https://github.com/Invoca/fibered_mysql2/compare/v0.1.2..v0.1.3
|
data/Gemfile
CHANGED
@@ -6,11 +6,11 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
|
6
6
|
gemspec
|
7
7
|
|
8
8
|
gem 'appraisal'
|
9
|
+
gem 'appraisal-matrix'
|
9
10
|
gem 'coveralls', require: false
|
10
11
|
gem 'mysql2', '~> 0.5'
|
11
|
-
gem 'nokogiri'
|
12
|
-
gem 'pry'
|
13
|
-
gem 'pry-byebug'
|
14
|
-
gem '
|
15
|
-
gem '
|
16
|
-
gem 'rspec', '~> 3.0'
|
12
|
+
gem 'nokogiri'
|
13
|
+
gem 'pry'
|
14
|
+
gem 'pry-byebug'
|
15
|
+
gem 'rake'
|
16
|
+
gem 'rspec'
|
data/Gemfile.lock
CHANGED
@@ -1,76 +1,83 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fibered_mysql2 (0.2.
|
4
|
+
fibered_mysql2 (0.2.1)
|
5
5
|
em-synchrony (~> 1.0)
|
6
6
|
rails (>= 5.2, < 7)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (6.
|
12
|
-
actionpack (= 6.
|
11
|
+
actioncable (6.1.7.8)
|
12
|
+
actionpack (= 6.1.7.8)
|
13
|
+
activesupport (= 6.1.7.8)
|
13
14
|
nio4r (~> 2.0)
|
14
15
|
websocket-driver (>= 0.6.1)
|
15
|
-
actionmailbox (6.
|
16
|
-
actionpack (= 6.
|
17
|
-
activejob (= 6.
|
18
|
-
activerecord (= 6.
|
19
|
-
activestorage (= 6.
|
20
|
-
activesupport (= 6.
|
16
|
+
actionmailbox (6.1.7.8)
|
17
|
+
actionpack (= 6.1.7.8)
|
18
|
+
activejob (= 6.1.7.8)
|
19
|
+
activerecord (= 6.1.7.8)
|
20
|
+
activestorage (= 6.1.7.8)
|
21
|
+
activesupport (= 6.1.7.8)
|
21
22
|
mail (>= 2.7.1)
|
22
|
-
actionmailer (6.
|
23
|
-
actionpack (= 6.
|
24
|
-
actionview (= 6.
|
25
|
-
activejob (= 6.
|
23
|
+
actionmailer (6.1.7.8)
|
24
|
+
actionpack (= 6.1.7.8)
|
25
|
+
actionview (= 6.1.7.8)
|
26
|
+
activejob (= 6.1.7.8)
|
27
|
+
activesupport (= 6.1.7.8)
|
26
28
|
mail (~> 2.5, >= 2.5.4)
|
27
29
|
rails-dom-testing (~> 2.0)
|
28
|
-
actionpack (6.
|
29
|
-
actionview (= 6.
|
30
|
-
activesupport (= 6.
|
31
|
-
rack (~> 2.0, >= 2.0.
|
30
|
+
actionpack (6.1.7.8)
|
31
|
+
actionview (= 6.1.7.8)
|
32
|
+
activesupport (= 6.1.7.8)
|
33
|
+
rack (~> 2.0, >= 2.0.9)
|
32
34
|
rack-test (>= 0.6.3)
|
33
35
|
rails-dom-testing (~> 2.0)
|
34
36
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
35
|
-
actiontext (6.
|
36
|
-
actionpack (= 6.
|
37
|
-
activerecord (= 6.
|
38
|
-
activestorage (= 6.
|
39
|
-
activesupport (= 6.
|
37
|
+
actiontext (6.1.7.8)
|
38
|
+
actionpack (= 6.1.7.8)
|
39
|
+
activerecord (= 6.1.7.8)
|
40
|
+
activestorage (= 6.1.7.8)
|
41
|
+
activesupport (= 6.1.7.8)
|
40
42
|
nokogiri (>= 1.8.5)
|
41
|
-
actionview (6.
|
42
|
-
activesupport (= 6.
|
43
|
+
actionview (6.1.7.8)
|
44
|
+
activesupport (= 6.1.7.8)
|
43
45
|
builder (~> 3.1)
|
44
46
|
erubi (~> 1.4)
|
45
47
|
rails-dom-testing (~> 2.0)
|
46
48
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
47
|
-
activejob (6.
|
48
|
-
activesupport (= 6.
|
49
|
+
activejob (6.1.7.8)
|
50
|
+
activesupport (= 6.1.7.8)
|
49
51
|
globalid (>= 0.3.6)
|
50
|
-
activemodel (6.
|
51
|
-
activesupport (= 6.
|
52
|
-
activerecord (6.
|
53
|
-
activemodel (= 6.
|
54
|
-
activesupport (= 6.
|
55
|
-
activestorage (6.
|
56
|
-
actionpack (= 6.
|
57
|
-
activejob (= 6.
|
58
|
-
activerecord (= 6.
|
59
|
-
|
60
|
-
|
52
|
+
activemodel (6.1.7.8)
|
53
|
+
activesupport (= 6.1.7.8)
|
54
|
+
activerecord (6.1.7.8)
|
55
|
+
activemodel (= 6.1.7.8)
|
56
|
+
activesupport (= 6.1.7.8)
|
57
|
+
activestorage (6.1.7.8)
|
58
|
+
actionpack (= 6.1.7.8)
|
59
|
+
activejob (= 6.1.7.8)
|
60
|
+
activerecord (= 6.1.7.8)
|
61
|
+
activesupport (= 6.1.7.8)
|
62
|
+
marcel (~> 1.0)
|
63
|
+
mini_mime (>= 1.1.0)
|
64
|
+
activesupport (6.1.7.8)
|
61
65
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
62
|
-
i18n (>=
|
63
|
-
minitest (
|
64
|
-
tzinfo (~>
|
65
|
-
zeitwerk (~> 2.
|
66
|
-
appraisal (2.
|
66
|
+
i18n (>= 1.6, < 2)
|
67
|
+
minitest (>= 5.1)
|
68
|
+
tzinfo (~> 2.0)
|
69
|
+
zeitwerk (~> 2.3)
|
70
|
+
appraisal (2.5.0)
|
67
71
|
bundler
|
68
72
|
rake
|
69
73
|
thor (>= 0.14.0)
|
70
|
-
|
74
|
+
appraisal-matrix (0.3.0)
|
75
|
+
appraisal (~> 2.2)
|
76
|
+
bigdecimal (3.1.8)
|
77
|
+
builder (3.3.0)
|
71
78
|
byebug (11.1.3)
|
72
79
|
coderay (1.1.3)
|
73
|
-
concurrent-ruby (1.
|
80
|
+
concurrent-ruby (1.3.4)
|
74
81
|
coveralls (0.8.23)
|
75
82
|
json (>= 1.8, < 3)
|
76
83
|
simplecov (~> 0.16.1)
|
@@ -78,126 +85,138 @@ GEM
|
|
78
85
|
thor (>= 0.19.4, < 2.0)
|
79
86
|
tins (~> 1.6)
|
80
87
|
crass (1.0.6)
|
81
|
-
|
82
|
-
|
88
|
+
date (3.3.4)
|
89
|
+
diff-lcs (1.5.1)
|
90
|
+
docile (1.4.1)
|
83
91
|
em-synchrony (1.0.6)
|
84
92
|
eventmachine (>= 1.0.0.beta.1)
|
85
|
-
erubi (1.
|
93
|
+
erubi (1.13.0)
|
86
94
|
eventmachine (1.2.7)
|
87
|
-
globalid (
|
88
|
-
activesupport (>=
|
89
|
-
i18n (1.
|
95
|
+
globalid (1.2.1)
|
96
|
+
activesupport (>= 6.1)
|
97
|
+
i18n (1.14.5)
|
90
98
|
concurrent-ruby (~> 1.0)
|
91
|
-
json (2.
|
92
|
-
loofah (2.
|
99
|
+
json (2.7.2)
|
100
|
+
loofah (2.22.0)
|
93
101
|
crass (~> 1.0.2)
|
94
|
-
nokogiri (>= 1.
|
95
|
-
mail (2.
|
102
|
+
nokogiri (>= 1.12.0)
|
103
|
+
mail (2.8.1)
|
96
104
|
mini_mime (>= 0.1.1)
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
105
|
+
net-imap
|
106
|
+
net-pop
|
107
|
+
net-smtp
|
108
|
+
marcel (1.0.4)
|
109
|
+
method_source (1.1.0)
|
110
|
+
mini_mime (1.1.5)
|
111
|
+
mini_portile2 (2.8.7)
|
112
|
+
minitest (5.25.1)
|
113
|
+
mysql2 (0.5.6)
|
114
|
+
net-imap (0.4.14)
|
115
|
+
date
|
116
|
+
net-protocol
|
117
|
+
net-pop (0.1.2)
|
118
|
+
net-protocol
|
119
|
+
net-protocol (0.2.2)
|
120
|
+
timeout
|
121
|
+
net-smtp (0.5.0)
|
122
|
+
net-protocol
|
123
|
+
nio4r (2.7.3)
|
124
|
+
nokogiri (1.16.7)
|
125
|
+
mini_portile2 (~> 2.8.2)
|
110
126
|
racc (~> 1.4)
|
111
|
-
pry (0.
|
127
|
+
pry (0.14.2)
|
112
128
|
coderay (~> 1.1)
|
113
129
|
method_source (~> 1.0)
|
114
|
-
pry-byebug (3.
|
130
|
+
pry-byebug (3.10.1)
|
115
131
|
byebug (~> 11.0)
|
116
|
-
pry (
|
117
|
-
racc (1.
|
118
|
-
rack (2.2.
|
119
|
-
rack-test (
|
120
|
-
rack (>= 1.
|
121
|
-
rails (6.
|
122
|
-
actioncable (= 6.
|
123
|
-
actionmailbox (= 6.
|
124
|
-
actionmailer (= 6.
|
125
|
-
actionpack (= 6.
|
126
|
-
actiontext (= 6.
|
127
|
-
actionview (= 6.
|
128
|
-
activejob (= 6.
|
129
|
-
activemodel (= 6.
|
130
|
-
activerecord (= 6.
|
131
|
-
activestorage (= 6.
|
132
|
-
activesupport (= 6.
|
133
|
-
bundler (>= 1.
|
134
|
-
railties (= 6.
|
132
|
+
pry (>= 0.13, < 0.15)
|
133
|
+
racc (1.8.1)
|
134
|
+
rack (2.2.9)
|
135
|
+
rack-test (2.1.0)
|
136
|
+
rack (>= 1.3)
|
137
|
+
rails (6.1.7.8)
|
138
|
+
actioncable (= 6.1.7.8)
|
139
|
+
actionmailbox (= 6.1.7.8)
|
140
|
+
actionmailer (= 6.1.7.8)
|
141
|
+
actionpack (= 6.1.7.8)
|
142
|
+
actiontext (= 6.1.7.8)
|
143
|
+
actionview (= 6.1.7.8)
|
144
|
+
activejob (= 6.1.7.8)
|
145
|
+
activemodel (= 6.1.7.8)
|
146
|
+
activerecord (= 6.1.7.8)
|
147
|
+
activestorage (= 6.1.7.8)
|
148
|
+
activesupport (= 6.1.7.8)
|
149
|
+
bundler (>= 1.15.0)
|
150
|
+
railties (= 6.1.7.8)
|
135
151
|
sprockets-rails (>= 2.0.0)
|
136
|
-
rails-dom-testing (2.0
|
137
|
-
activesupport (>=
|
152
|
+
rails-dom-testing (2.2.0)
|
153
|
+
activesupport (>= 5.0.0)
|
154
|
+
minitest
|
138
155
|
nokogiri (>= 1.6)
|
139
|
-
rails-html-sanitizer (1.
|
140
|
-
loofah (~> 2.
|
141
|
-
|
142
|
-
|
143
|
-
|
156
|
+
rails-html-sanitizer (1.6.0)
|
157
|
+
loofah (~> 2.21)
|
158
|
+
nokogiri (~> 1.14)
|
159
|
+
railties (6.1.7.8)
|
160
|
+
actionpack (= 6.1.7.8)
|
161
|
+
activesupport (= 6.1.7.8)
|
144
162
|
method_source
|
145
|
-
rake (>=
|
146
|
-
thor (
|
147
|
-
rake (13.
|
148
|
-
rspec (3.
|
149
|
-
rspec-core (~> 3.
|
150
|
-
rspec-expectations (~> 3.
|
151
|
-
rspec-mocks (~> 3.
|
152
|
-
rspec-core (3.
|
153
|
-
rspec-support (~> 3.
|
154
|
-
rspec-expectations (3.
|
163
|
+
rake (>= 12.2)
|
164
|
+
thor (~> 1.0)
|
165
|
+
rake (13.2.1)
|
166
|
+
rspec (3.13.0)
|
167
|
+
rspec-core (~> 3.13.0)
|
168
|
+
rspec-expectations (~> 3.13.0)
|
169
|
+
rspec-mocks (~> 3.13.0)
|
170
|
+
rspec-core (3.13.0)
|
171
|
+
rspec-support (~> 3.13.0)
|
172
|
+
rspec-expectations (3.13.1)
|
155
173
|
diff-lcs (>= 1.2.0, < 2.0)
|
156
|
-
rspec-support (~> 3.
|
157
|
-
rspec-mocks (3.
|
174
|
+
rspec-support (~> 3.13.0)
|
175
|
+
rspec-mocks (3.13.1)
|
158
176
|
diff-lcs (>= 1.2.0, < 2.0)
|
159
|
-
rspec-support (~> 3.
|
160
|
-
rspec-support (3.
|
177
|
+
rspec-support (~> 3.13.0)
|
178
|
+
rspec-support (3.13.1)
|
161
179
|
simplecov (0.16.1)
|
162
180
|
docile (~> 1.1)
|
163
181
|
json (>= 1.8, < 3)
|
164
182
|
simplecov-html (~> 0.10.0)
|
165
183
|
simplecov-html (0.10.2)
|
166
|
-
sprockets (4.
|
184
|
+
sprockets (4.2.1)
|
167
185
|
concurrent-ruby (~> 1.0)
|
168
|
-
rack (
|
169
|
-
sprockets-rails (3.
|
170
|
-
actionpack (>=
|
171
|
-
activesupport (>=
|
186
|
+
rack (>= 2.2.4, < 4)
|
187
|
+
sprockets-rails (3.5.2)
|
188
|
+
actionpack (>= 6.1)
|
189
|
+
activesupport (>= 6.1)
|
172
190
|
sprockets (>= 3.0.0)
|
173
191
|
sync (0.5.0)
|
174
|
-
term-ansicolor (1.
|
192
|
+
term-ansicolor (1.11.2)
|
175
193
|
tins (~> 1.0)
|
176
|
-
thor (1.
|
177
|
-
|
178
|
-
tins (1.
|
194
|
+
thor (1.3.1)
|
195
|
+
timeout (0.4.1)
|
196
|
+
tins (1.33.0)
|
197
|
+
bigdecimal
|
179
198
|
sync
|
180
|
-
tzinfo (
|
181
|
-
|
182
|
-
websocket-driver (0.7.
|
199
|
+
tzinfo (2.0.6)
|
200
|
+
concurrent-ruby (~> 1.0)
|
201
|
+
websocket-driver (0.7.6)
|
183
202
|
websocket-extensions (>= 0.1.0)
|
184
203
|
websocket-extensions (0.1.5)
|
185
|
-
zeitwerk (2.
|
204
|
+
zeitwerk (2.6.17)
|
186
205
|
|
187
206
|
PLATFORMS
|
188
207
|
ruby
|
189
208
|
|
190
209
|
DEPENDENCIES
|
191
210
|
appraisal
|
211
|
+
appraisal-matrix
|
192
212
|
coveralls
|
193
213
|
fibered_mysql2!
|
194
214
|
mysql2 (~> 0.5)
|
195
|
-
nokogiri
|
196
|
-
pry
|
197
|
-
pry-byebug
|
198
|
-
|
199
|
-
|
200
|
-
rspec (~> 3.0)
|
215
|
+
nokogiri
|
216
|
+
pry
|
217
|
+
pry-byebug
|
218
|
+
rake
|
219
|
+
rspec
|
201
220
|
|
202
221
|
BUNDLED WITH
|
203
222
|
2.2.29
|
@@ -3,13 +3,14 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "appraisal"
|
6
|
+
gem "appraisal-matrix"
|
6
7
|
gem "coveralls", require: false
|
7
8
|
gem "mysql2", "~> 0.5"
|
8
|
-
gem "nokogiri"
|
9
|
-
gem "pry"
|
10
|
-
gem "pry-byebug"
|
9
|
+
gem "nokogiri"
|
10
|
+
gem "pry"
|
11
|
+
gem "pry-byebug"
|
12
|
+
gem "rake"
|
13
|
+
gem "rspec"
|
11
14
|
gem "rails", "~> 6.0.0"
|
12
|
-
gem "rake", "~> 13.0"
|
13
|
-
gem "rspec", "~> 3.0"
|
14
15
|
|
15
16
|
gemspec path: "../"
|
@@ -3,13 +3,14 @@
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
5
|
gem "appraisal"
|
6
|
+
gem "appraisal-matrix"
|
6
7
|
gem "coveralls", require: false
|
7
8
|
gem "mysql2", "~> 0.5"
|
8
|
-
gem "nokogiri"
|
9
|
-
gem "pry"
|
10
|
-
gem "pry-byebug"
|
11
|
-
gem "
|
12
|
-
gem "
|
13
|
-
gem "
|
9
|
+
gem "nokogiri"
|
10
|
+
gem "pry"
|
11
|
+
gem "pry-byebug"
|
12
|
+
gem "rake"
|
13
|
+
gem "rspec"
|
14
|
+
gem "rails", "~> 6.1.0"
|
14
15
|
|
15
16
|
gemspec path: "../"
|
@@ -75,14 +75,8 @@ module FiberedMysql2
|
|
75
75
|
case ::Rails::VERSION::MAJOR
|
76
76
|
when 4
|
77
77
|
include FiberedMysql2Adapter_4_2
|
78
|
-
when 5
|
78
|
+
when 5, 6
|
79
79
|
include FiberedMysql2Adapter_5_2
|
80
|
-
when 6
|
81
|
-
include FiberedMysql2Adapter_5_2
|
82
|
-
|
83
|
-
def supports_lazy_transactions?
|
84
|
-
false
|
85
|
-
end
|
86
80
|
end
|
87
81
|
|
88
82
|
def initialize(*args)
|
@@ -238,8 +238,12 @@ module FiberedMysql2
|
|
238
238
|
end
|
239
239
|
|
240
240
|
def initialize(connection_spec, *args, **keyword_args)
|
241
|
-
|
242
|
-
|
241
|
+
if ActiveRecord.gem_version < "6.1"
|
242
|
+
connection_spec.config[:reaping_frequency] and raise "reaping_frequency is not supported (the ActiveRecord Reaper is thread-based)"
|
243
|
+
connection_spec.config[:reaping_frequency] = nil # starting in Rails 5, this defaults to 60 if not explicitly set
|
244
|
+
elsif connection_spec.db_config.reaping_frequency
|
245
|
+
connection_spec.db_config.reaping_frequency > 0 and raise "reaping_frequency is not supported (the ActiveRecord Reaper is thread-based)"
|
246
|
+
end
|
243
247
|
|
244
248
|
super(connection_spec, *args, **keyword_args)
|
245
249
|
|
@@ -32,10 +32,17 @@ module EM::Synchrony
|
|
32
32
|
run_commit_callbacks = !current_transaction.joinable?
|
33
33
|
transaction =
|
34
34
|
if _current_stack.empty?
|
35
|
-
::ActiveRecord
|
35
|
+
if ::ActiveRecord.gem_version < "6.1"
|
36
|
+
::ActiveRecord::ConnectionAdapters::RealTransaction.new(@connection, options, run_commit_callbacks: run_commit_callbacks)
|
37
|
+
else
|
38
|
+
::ActiveRecord::ConnectionAdapters::RealTransaction.new(@connection, **options, run_commit_callbacks: run_commit_callbacks)
|
39
|
+
end
|
36
40
|
else
|
37
|
-
::ActiveRecord
|
38
|
-
|
41
|
+
if ::ActiveRecord.gem_version < "6.1"
|
42
|
+
::ActiveRecord::ConnectionAdapters::SavepointTransaction.new(@connection, "active_record_#{Fiber.current.object_id}_#{open_transactions}", _current_stack.last, options, run_commit_callbacks: run_commit_callbacks)
|
43
|
+
else
|
44
|
+
::ActiveRecord::ConnectionAdapters::SavepointTransaction.new(@connection, "active_record_#{Fiber.current.object_id}_#{open_transactions}", _current_stack.last, **options, run_commit_callbacks: run_commit_callbacks)
|
45
|
+
end
|
39
46
|
end
|
40
47
|
|
41
48
|
if @connection.supports_lazy_transactions? && lazy_transactions_enabled? && options[:_lazy] != false
|
@@ -47,6 +54,53 @@ module EM::Synchrony
|
|
47
54
|
transaction
|
48
55
|
end
|
49
56
|
end
|
57
|
+
|
58
|
+
# Overriding the ActiveRecord::TransactionManager#materialize_transactions method to use
|
59
|
+
# fiber safe the _current_stack instead of the @stack instance variable. when marterializing
|
60
|
+
# transactions.
|
61
|
+
def materialize_transactions
|
62
|
+
return if @materializing_transactions
|
63
|
+
return unless @has_unmaterialized_transactions
|
64
|
+
|
65
|
+
@connection.lock.synchronize do
|
66
|
+
begin
|
67
|
+
@materializing_transactions = true
|
68
|
+
_current_stack.each { |t| t.materialize! unless t.materialized? }
|
69
|
+
ensure
|
70
|
+
@materializing_transactions = false
|
71
|
+
end
|
72
|
+
@has_unmaterialized_transactions = false
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Overriding the ActiveRecord::TransactionManager#commit_transaction method to use
|
77
|
+
# fiber safe the _current_stack instead of the @stack instance variable. when marterializing
|
78
|
+
# transactions.
|
79
|
+
def commit_transaction
|
80
|
+
@connection.lock.synchronize do
|
81
|
+
transaction = _current_stack.last
|
82
|
+
|
83
|
+
begin
|
84
|
+
transaction.before_commit_records
|
85
|
+
ensure
|
86
|
+
_current_stack.pop
|
87
|
+
end
|
88
|
+
|
89
|
+
transaction.commit
|
90
|
+
transaction.commit_records
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# Overriding the ActiveRecord::TransactionManager#rollback_transaction method to use
|
95
|
+
# fiber safe the _current_stack instead of the @stack instance variable. when marterializing
|
96
|
+
# transactions.
|
97
|
+
def rollback_transaction(transaction = nil)
|
98
|
+
@connection.lock.synchronize do
|
99
|
+
transaction ||= _current_stack.pop
|
100
|
+
transaction.rollback
|
101
|
+
transaction.rollback_records
|
102
|
+
end
|
103
|
+
end
|
50
104
|
end
|
51
105
|
end
|
52
106
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module FiberedMysql2
|
4
|
+
module HashConfigOverride
|
5
|
+
# Override the reaping_frequency method to return nil so that the connection pool does not reap connections when in fibered mode.
|
6
|
+
def reaping_frequency
|
7
|
+
nil
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
if ActiveRecord.gem_version >= "6.1"
|
13
|
+
ActiveRecord::DatabaseConfigurations::HashConfig.prepend(FiberedMysql2::HashConfigOverride)
|
14
|
+
end
|
data/lib/fibered_mysql2.rb
CHANGED
@@ -5,6 +5,7 @@ require_relative '../lib/active_record/connection_adapters/fibered_mysql2_adapte
|
|
5
5
|
require 'fibered_mysql2/fibered_database_connection_pool'
|
6
6
|
require 'fibered_mysql2/fibered_mutex_with_waiter_priority'
|
7
7
|
require 'fibered_mysql2/fibered_mysql2_connection_factory'
|
8
|
+
require_relative 'fibered_mysql2/hash_config_override'
|
8
9
|
|
9
10
|
module FiberedMysql2
|
10
11
|
class Error < StandardError; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fibered_mysql2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Invoca Development
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: em-synchrony
|
@@ -65,13 +65,15 @@ files:
|
|
65
65
|
- bin/console
|
66
66
|
- bin/setup
|
67
67
|
- fibered_mysql2.gemspec
|
68
|
-
- gemfiles/
|
69
|
-
- gemfiles/
|
68
|
+
- gemfiles/.bundle/config
|
69
|
+
- gemfiles/rails_6_0.gemfile
|
70
|
+
- gemfiles/rails_6_1.gemfile
|
70
71
|
- lib/active_record/connection_adapters/fibered_mysql2_adapter.rb
|
71
72
|
- lib/fibered_mysql2.rb
|
72
73
|
- lib/fibered_mysql2/fibered_database_connection_pool.rb
|
73
74
|
- lib/fibered_mysql2/fibered_mutex_with_waiter_priority.rb
|
74
75
|
- lib/fibered_mysql2/fibered_mysql2_connection_factory.rb
|
76
|
+
- lib/fibered_mysql2/hash_config_override.rb
|
75
77
|
- lib/fibered_mysql2/version.rb
|
76
78
|
homepage: https://github.com/Invoca/fibered_mysql2
|
77
79
|
licenses: []
|
@@ -89,11 +91,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
91
|
version: '0'
|
90
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
93
|
requirements:
|
92
|
-
- - "
|
94
|
+
- - ">="
|
93
95
|
- !ruby/object:Gem::Version
|
94
|
-
version:
|
96
|
+
version: '0'
|
95
97
|
requirements: []
|
96
|
-
rubygems_version: 3.
|
98
|
+
rubygems_version: 3.3.27
|
97
99
|
signing_key:
|
98
100
|
specification_version: 4
|
99
101
|
summary: An adapter for fibered mysql2
|