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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c336888076880a85f5be10b2784991a2a27784e9a3858bf97f79fe782ac6417f
4
- data.tar.gz: 59b46276bb6fbc0f6ee2c609195e438cc440dc160b13b26b2d113d034fac004f
3
+ metadata.gz: 9e44e8e3a3b531c9fe568f4d0fcbd19dea85b92e0fc391ca9e50c898b0119359
4
+ data.tar.gz: e41214cb8676608ed5ec6a22dbabea0dfa6d02d41e5ec3a78be4ce0057e76817
5
5
  SHA512:
6
- metadata.gz: 4df7a46c2f65f930c08fc5233e73d4fd8b13d4b899feffe04b40d45ea944e4e35c89eae567d77187fdc6fd416a25b6080bb0fd2de7b4a1d8dc10e054c508f692
7
- data.tar.gz: 38300d691395f2f0c89cc4304c9e9f44df21f6e7df479ca9369e34829faa6eb3a366a0b0c470e1121a3311e8704f3b536fbcdff22fc7a974ff1ef0944ba00e50
6
+ metadata.gz: 3d55a57ce410ccbbbe0c31c08e8dce4f3115ad175ac71cd9747d2072a9771c068c43bfbc05c374631e1f80484619a3adfcee98cfe00eb57fe6458204c538d285
7
+ data.tar.gz: 3301cac13fa5c7c2140660e3282f50c06ad3d3bac53a1afe02be328eb5d9e7580e4441e413993fe060a8c1db49d3884c8beafd0295d0dbdc95b9e0113ba1b680
@@ -8,11 +8,11 @@ jobs:
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- ruby: [2.5, 2.6, 2.7, '3.0', 3.1]
11
+ ruby: [3.1, 3.2, 3.3]
12
12
  gemfile:
13
13
  - Gemfile
14
- - gemfiles/rails_5.gemfile
15
- - gemfiles/rails_6.gemfile
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
- 2.7.5
1
+ 3.1.6
data/Appraisals CHANGED
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- appraise 'rails-5' do
4
- gem 'rails', '~> 5.2'
5
- end
3
+ require "appraisal/matrix"
6
4
 
7
- appraise 'rails-6' do
8
- gem 'rails', '~> 6.0.0'
9
- end
5
+ appraisal_matrix(rails: "~> 6.0")
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', '< 1.13'
12
- gem 'pry', '~> 0.13'
13
- gem 'pry-byebug', '~> 3.9'
14
- gem 'rails', '< 6.1'
15
- gem 'rake', '~> 13.0'
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.0.pre.1)
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.0.3.4)
12
- actionpack (= 6.0.3.4)
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.0.3.4)
16
- actionpack (= 6.0.3.4)
17
- activejob (= 6.0.3.4)
18
- activerecord (= 6.0.3.4)
19
- activestorage (= 6.0.3.4)
20
- activesupport (= 6.0.3.4)
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.0.3.4)
23
- actionpack (= 6.0.3.4)
24
- actionview (= 6.0.3.4)
25
- activejob (= 6.0.3.4)
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.0.3.4)
29
- actionview (= 6.0.3.4)
30
- activesupport (= 6.0.3.4)
31
- rack (~> 2.0, >= 2.0.8)
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.0.3.4)
36
- actionpack (= 6.0.3.4)
37
- activerecord (= 6.0.3.4)
38
- activestorage (= 6.0.3.4)
39
- activesupport (= 6.0.3.4)
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.0.3.4)
42
- activesupport (= 6.0.3.4)
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.0.3.4)
48
- activesupport (= 6.0.3.4)
49
+ activejob (6.1.7.8)
50
+ activesupport (= 6.1.7.8)
49
51
  globalid (>= 0.3.6)
50
- activemodel (6.0.3.4)
51
- activesupport (= 6.0.3.4)
52
- activerecord (6.0.3.4)
53
- activemodel (= 6.0.3.4)
54
- activesupport (= 6.0.3.4)
55
- activestorage (6.0.3.4)
56
- actionpack (= 6.0.3.4)
57
- activejob (= 6.0.3.4)
58
- activerecord (= 6.0.3.4)
59
- marcel (~> 0.3.1)
60
- activesupport (6.0.3.4)
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 (>= 0.7, < 2)
63
- minitest (~> 5.1)
64
- tzinfo (~> 1.1)
65
- zeitwerk (~> 2.2, >= 2.2.2)
66
- appraisal (2.4.0)
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
- builder (3.2.4)
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.1.8)
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
- diff-lcs (1.4.4)
82
- docile (1.3.2)
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.10.0)
93
+ erubi (1.13.0)
86
94
  eventmachine (1.2.7)
87
- globalid (0.4.2)
88
- activesupport (>= 4.2.0)
89
- i18n (1.8.7)
95
+ globalid (1.2.1)
96
+ activesupport (>= 6.1)
97
+ i18n (1.14.5)
90
98
  concurrent-ruby (~> 1.0)
91
- json (2.3.1)
92
- loofah (2.8.0)
99
+ json (2.7.2)
100
+ loofah (2.22.0)
93
101
  crass (~> 1.0.2)
94
- nokogiri (>= 1.5.9)
95
- mail (2.7.1)
102
+ nokogiri (>= 1.12.0)
103
+ mail (2.8.1)
96
104
  mini_mime (>= 0.1.1)
97
- marcel (0.3.3)
98
- mimemagic (~> 0.3.2)
99
- method_source (1.0.0)
100
- mimemagic (0.3.10)
101
- nokogiri (~> 1)
102
- rake
103
- mini_mime (1.0.2)
104
- mini_portile2 (2.6.1)
105
- minitest (5.14.3)
106
- mysql2 (0.5.3)
107
- nio4r (2.5.4)
108
- nokogiri (1.12.5)
109
- mini_portile2 (~> 2.6.1)
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.13.1)
127
+ pry (0.14.2)
112
128
  coderay (~> 1.1)
113
129
  method_source (~> 1.0)
114
- pry-byebug (3.9.0)
130
+ pry-byebug (3.10.1)
115
131
  byebug (~> 11.0)
116
- pry (~> 0.13.0)
117
- racc (1.6.0)
118
- rack (2.2.3)
119
- rack-test (1.1.0)
120
- rack (>= 1.0, < 3)
121
- rails (6.0.3.4)
122
- actioncable (= 6.0.3.4)
123
- actionmailbox (= 6.0.3.4)
124
- actionmailer (= 6.0.3.4)
125
- actionpack (= 6.0.3.4)
126
- actiontext (= 6.0.3.4)
127
- actionview (= 6.0.3.4)
128
- activejob (= 6.0.3.4)
129
- activemodel (= 6.0.3.4)
130
- activerecord (= 6.0.3.4)
131
- activestorage (= 6.0.3.4)
132
- activesupport (= 6.0.3.4)
133
- bundler (>= 1.3.0)
134
- railties (= 6.0.3.4)
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.3)
137
- activesupport (>= 4.2.0)
152
+ rails-dom-testing (2.2.0)
153
+ activesupport (>= 5.0.0)
154
+ minitest
138
155
  nokogiri (>= 1.6)
139
- rails-html-sanitizer (1.3.0)
140
- loofah (~> 2.3)
141
- railties (6.0.3.4)
142
- actionpack (= 6.0.3.4)
143
- activesupport (= 6.0.3.4)
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 (>= 0.8.7)
146
- thor (>= 0.20.3, < 2.0)
147
- rake (13.0.6)
148
- rspec (3.9.0)
149
- rspec-core (~> 3.9.0)
150
- rspec-expectations (~> 3.9.0)
151
- rspec-mocks (~> 3.9.0)
152
- rspec-core (3.9.3)
153
- rspec-support (~> 3.9.3)
154
- rspec-expectations (3.9.2)
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.9.0)
157
- rspec-mocks (3.9.1)
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.9.0)
160
- rspec-support (3.9.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.0.2)
184
+ sprockets (4.2.1)
167
185
  concurrent-ruby (~> 1.0)
168
- rack (> 1, < 3)
169
- sprockets-rails (3.2.2)
170
- actionpack (>= 4.0)
171
- activesupport (>= 4.0)
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.7.1)
192
+ term-ansicolor (1.11.2)
175
193
  tins (~> 1.0)
176
- thor (1.0.1)
177
- thread_safe (0.3.6)
178
- tins (1.25.0)
194
+ thor (1.3.1)
195
+ timeout (0.4.1)
196
+ tins (1.33.0)
197
+ bigdecimal
179
198
  sync
180
- tzinfo (1.2.9)
181
- thread_safe (~> 0.1)
182
- websocket-driver (0.7.3)
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.4.1)
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 (< 1.13)
196
- pry (~> 0.13)
197
- pry-byebug (~> 3.9)
198
- rails (< 6.1)
199
- rake (~> 13.0)
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
@@ -0,0 +1,2 @@
1
+ ---
2
+ BUNDLE_RETRY: "1"
@@ -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", "< 1.13"
9
- gem "pry", "~> 0.13"
10
- gem "pry-byebug", "~> 3.9"
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", "< 1.13"
9
- gem "pry", "~> 0.13"
10
- gem "pry-byebug", "~> 3.9"
11
- gem "rails", "~> 5.2"
12
- gem "rake", "~> 13.0"
13
- gem "rspec", "~> 3.0"
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
- connection_spec.config[:reaping_frequency] and raise "reaping_frequency is not supported (the ActiveRecord Reaper is thread-based)"
242
- connection_spec.config[:reaping_frequency] = nil # starting in Rails 5, this defaults to 60 if not explicitly set
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::ConnectionAdapters::RealTransaction.new(@connection, options, run_commit_callbacks: run_commit_callbacks)
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::ConnectionAdapters::SavepointTransaction.new(@connection, "active_record_#{Fiber.current.object_id}_#{open_transactions}", _current_stack.last, options,
38
- run_commit_callbacks: run_commit_callbacks)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FiberedMysql2
4
- VERSION = "0.2.0.pre.1"
4
+ VERSION = "0.2.1"
5
5
  end
@@ -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.0.pre.1
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: 2023-01-10 00:00:00.000000000 Z
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/rails_5.gemfile
69
- - gemfiles/rails_6.gemfile
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: 1.3.1
96
+ version: '0'
95
97
  requirements: []
96
- rubygems_version: 3.1.6
98
+ rubygems_version: 3.3.27
97
99
  signing_key:
98
100
  specification_version: 4
99
101
  summary: An adapter for fibered mysql2