fibered_mysql2 0.3.2.pre.tstarck.3 → 0.4.0.pre.tstarck.1
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/.github/workflows/build.yml +3 -3
- data/.ruby-version +1 -1
- data/Appraisals +7 -1
- data/CHANGELOG.md +17 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +125 -80
- data/fibered_mysql2.gemspec +1 -1
- data/gemfiles/rails_7_0.gemfile +4 -2
- data/gemfiles/rails_7_1.gemfile +15 -0
- data/lib/active_record/connection_adapters/fibered_mysql2_adapter.rb +5 -6
- data/lib/fibered_mysql2/fibered_database_connection_pool.rb +19 -37
- data/lib/fibered_mysql2/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4de2661b6a53134802496ea91ed73ad10623ee8459f1d4ecdb1ebdef6ea4f63
|
4
|
+
data.tar.gz: 8846ea290e1ed8ccab648c55458809b63cb4a1ca737f405f0ece815b441104cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68e08cebe9eec799298274fa1be5e3f83f7b896b5cbdebad3b3b5cb082fabb92388b80310cdb8bd376605374db8460dad4f9fde4746385d9e9d03f53278bf0a2
|
7
|
+
data.tar.gz: 1ea97ac7495a0bc0085aaf4f45e226ad9110f879d893673ae646c48753f90f4c456156bb29ca63c36ddf827fff96a7aab934f80d43c27dbc534fd602db8472be
|
data/.github/workflows/build.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
---
|
2
2
|
name: FiberedMySQL2 Gem Build
|
3
|
-
on: [push]
|
3
|
+
on: [push, pull_request]
|
4
4
|
jobs:
|
5
5
|
test:
|
6
6
|
name: Unit Tests
|
@@ -8,10 +8,11 @@ jobs:
|
|
8
8
|
strategy:
|
9
9
|
fail-fast: false
|
10
10
|
matrix:
|
11
|
-
ruby: [3.1, 3.2, 3.3]
|
11
|
+
ruby: [3.1, 3.2, 3.3, 3.4]
|
12
12
|
gemfile:
|
13
13
|
- Gemfile
|
14
14
|
- gemfiles/rails_7_0.gemfile
|
15
|
+
- gemfiles/rails_7_1.gemfile
|
15
16
|
env:
|
16
17
|
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
17
18
|
steps:
|
@@ -19,6 +20,5 @@ jobs:
|
|
19
20
|
- uses: ruby/setup-ruby@v1
|
20
21
|
with:
|
21
22
|
ruby-version: ${{ matrix.ruby }}
|
22
|
-
bundler: 2.2.29
|
23
23
|
bundler-cache: true
|
24
24
|
- run: bundle exec rspec
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.3.8
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,23 @@ 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.4.0] - Unreleased
|
8
|
+
### Added
|
9
|
+
- Support for Rails 7.1
|
10
|
+
|
11
|
+
### Removed
|
12
|
+
- Removed support for Rails 6.1 and below.
|
13
|
+
|
14
|
+
### Changed
|
15
|
+
#### FiberedMysql2Adapter
|
16
|
+
- Updated to no longer include EM::Synchrony::ActiveRecord::Adapter_4_2 as it is no longer necessary.
|
17
|
+
- Removed TransactionManager overrides as they are no longer necessary.
|
18
|
+
|
19
|
+
#### FiberedMysql2::FiberedDatabaseConnectionPool
|
20
|
+
- Updated to only override methods needed in Rails 7.0.
|
21
|
+
- Removed double-checking in #connection for cached connection.
|
22
|
+
- Updated #checkout patch to use #reap instead of our custom #reaped_connections method.
|
23
|
+
|
7
24
|
## [0.3.1] - 2024-10-30
|
8
25
|
### Fixed
|
9
26
|
- Fixed bug in FiberedMysqlAdapter.new_client that was causing `uninitialized constant` errors.
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,77 +1,89 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fibered_mysql2 (0.
|
4
|
+
fibered_mysql2 (0.4.0.pre.tstarck.1)
|
5
5
|
em-synchrony (~> 1.0)
|
6
|
-
rails (>= 7.0, < 7.
|
6
|
+
rails (>= 7.0, < 7.2)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (7.
|
12
|
-
actionpack (= 7.
|
13
|
-
activesupport (= 7.
|
11
|
+
actioncable (7.1.5.1)
|
12
|
+
actionpack (= 7.1.5.1)
|
13
|
+
activesupport (= 7.1.5.1)
|
14
14
|
nio4r (~> 2.0)
|
15
15
|
websocket-driver (>= 0.6.1)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
zeitwerk (~> 2.6)
|
17
|
+
actionmailbox (7.1.5.1)
|
18
|
+
actionpack (= 7.1.5.1)
|
19
|
+
activejob (= 7.1.5.1)
|
20
|
+
activerecord (= 7.1.5.1)
|
21
|
+
activestorage (= 7.1.5.1)
|
22
|
+
activesupport (= 7.1.5.1)
|
22
23
|
mail (>= 2.7.1)
|
23
24
|
net-imap
|
24
25
|
net-pop
|
25
26
|
net-smtp
|
26
|
-
actionmailer (7.
|
27
|
-
actionpack (= 7.
|
28
|
-
actionview (= 7.
|
29
|
-
activejob (= 7.
|
30
|
-
activesupport (= 7.
|
27
|
+
actionmailer (7.1.5.1)
|
28
|
+
actionpack (= 7.1.5.1)
|
29
|
+
actionview (= 7.1.5.1)
|
30
|
+
activejob (= 7.1.5.1)
|
31
|
+
activesupport (= 7.1.5.1)
|
31
32
|
mail (~> 2.5, >= 2.5.4)
|
32
33
|
net-imap
|
33
34
|
net-pop
|
34
35
|
net-smtp
|
35
|
-
rails-dom-testing (~> 2.
|
36
|
-
actionpack (7.
|
37
|
-
actionview (= 7.
|
38
|
-
activesupport (= 7.
|
39
|
-
|
36
|
+
rails-dom-testing (~> 2.2)
|
37
|
+
actionpack (7.1.5.1)
|
38
|
+
actionview (= 7.1.5.1)
|
39
|
+
activesupport (= 7.1.5.1)
|
40
|
+
nokogiri (>= 1.8.5)
|
41
|
+
racc
|
42
|
+
rack (>= 2.2.4)
|
43
|
+
rack-session (>= 1.0.1)
|
40
44
|
rack-test (>= 0.6.3)
|
41
|
-
rails-dom-testing (~> 2.
|
42
|
-
rails-html-sanitizer (~> 1.
|
43
|
-
actiontext (7.
|
44
|
-
actionpack (= 7.
|
45
|
-
activerecord (= 7.
|
46
|
-
activestorage (= 7.
|
47
|
-
activesupport (= 7.
|
45
|
+
rails-dom-testing (~> 2.2)
|
46
|
+
rails-html-sanitizer (~> 1.6)
|
47
|
+
actiontext (7.1.5.1)
|
48
|
+
actionpack (= 7.1.5.1)
|
49
|
+
activerecord (= 7.1.5.1)
|
50
|
+
activestorage (= 7.1.5.1)
|
51
|
+
activesupport (= 7.1.5.1)
|
48
52
|
globalid (>= 0.6.0)
|
49
53
|
nokogiri (>= 1.8.5)
|
50
|
-
actionview (7.
|
51
|
-
activesupport (= 7.
|
54
|
+
actionview (7.1.5.1)
|
55
|
+
activesupport (= 7.1.5.1)
|
52
56
|
builder (~> 3.1)
|
53
|
-
erubi (~> 1.
|
54
|
-
rails-dom-testing (~> 2.
|
55
|
-
rails-html-sanitizer (~> 1.
|
56
|
-
activejob (7.
|
57
|
-
activesupport (= 7.
|
57
|
+
erubi (~> 1.11)
|
58
|
+
rails-dom-testing (~> 2.2)
|
59
|
+
rails-html-sanitizer (~> 1.6)
|
60
|
+
activejob (7.1.5.1)
|
61
|
+
activesupport (= 7.1.5.1)
|
58
62
|
globalid (>= 0.3.6)
|
59
|
-
activemodel (7.
|
60
|
-
activesupport (= 7.
|
61
|
-
activerecord (7.
|
62
|
-
activemodel (= 7.
|
63
|
-
activesupport (= 7.
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
63
|
+
activemodel (7.1.5.1)
|
64
|
+
activesupport (= 7.1.5.1)
|
65
|
+
activerecord (7.1.5.1)
|
66
|
+
activemodel (= 7.1.5.1)
|
67
|
+
activesupport (= 7.1.5.1)
|
68
|
+
timeout (>= 0.4.0)
|
69
|
+
activestorage (7.1.5.1)
|
70
|
+
actionpack (= 7.1.5.1)
|
71
|
+
activejob (= 7.1.5.1)
|
72
|
+
activerecord (= 7.1.5.1)
|
73
|
+
activesupport (= 7.1.5.1)
|
69
74
|
marcel (~> 1.0)
|
70
|
-
|
71
|
-
|
75
|
+
activesupport (7.1.5.1)
|
76
|
+
base64
|
77
|
+
benchmark (>= 0.3)
|
78
|
+
bigdecimal
|
72
79
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
80
|
+
connection_pool (>= 2.2.5)
|
81
|
+
drb
|
73
82
|
i18n (>= 1.6, < 2)
|
83
|
+
logger (>= 1.4.2)
|
74
84
|
minitest (>= 5.1)
|
85
|
+
mutex_m
|
86
|
+
securerandom (>= 0.3)
|
75
87
|
tzinfo (~> 2.0)
|
76
88
|
appraisal (2.5.0)
|
77
89
|
bundler
|
@@ -80,21 +92,34 @@ GEM
|
|
80
92
|
appraisal-matrix (0.3.0)
|
81
93
|
appraisal (~> 2.2)
|
82
94
|
base64 (0.3.0)
|
95
|
+
benchmark (0.4.1)
|
96
|
+
bigdecimal (3.2.2)
|
83
97
|
builder (3.3.0)
|
84
98
|
byebug (12.0.0)
|
99
|
+
cgi (0.5.0)
|
85
100
|
coderay (1.1.3)
|
86
101
|
concurrent-ruby (1.3.5)
|
102
|
+
connection_pool (2.5.3)
|
87
103
|
crass (1.0.6)
|
88
104
|
date (3.4.1)
|
89
105
|
diff-lcs (1.6.2)
|
106
|
+
drb (2.2.3)
|
90
107
|
em-synchrony (1.0.6)
|
91
108
|
eventmachine (>= 1.0.0.beta.1)
|
109
|
+
erb (4.0.4)
|
110
|
+
cgi (>= 0.3.3)
|
92
111
|
erubi (1.13.1)
|
93
112
|
eventmachine (1.2.7)
|
94
113
|
globalid (1.2.1)
|
95
114
|
activesupport (>= 6.1)
|
96
115
|
i18n (1.14.7)
|
97
116
|
concurrent-ruby (~> 1.0)
|
117
|
+
io-console (0.8.1)
|
118
|
+
irb (1.15.2)
|
119
|
+
pp (>= 0.6.0)
|
120
|
+
rdoc (>= 4.0.0)
|
121
|
+
reline (>= 0.4.2)
|
122
|
+
logger (1.7.0)
|
98
123
|
loofah (2.24.1)
|
99
124
|
crass (~> 1.0.2)
|
100
125
|
nokogiri (>= 1.12.0)
|
@@ -108,6 +133,7 @@ GEM
|
|
108
133
|
mini_mime (1.1.5)
|
109
134
|
mini_portile2 (2.8.9)
|
110
135
|
minitest (5.25.5)
|
136
|
+
mutex_m (0.3.0)
|
111
137
|
mysql2 (0.5.6)
|
112
138
|
net-imap (0.5.9)
|
113
139
|
date
|
@@ -122,30 +148,41 @@ GEM
|
|
122
148
|
nokogiri (1.18.9)
|
123
149
|
mini_portile2 (~> 2.8.2)
|
124
150
|
racc (~> 1.4)
|
151
|
+
pp (0.6.2)
|
152
|
+
prettyprint
|
153
|
+
prettyprint (0.2.0)
|
125
154
|
pry (0.15.2)
|
126
155
|
coderay (~> 1.1)
|
127
156
|
method_source (~> 1.0)
|
128
157
|
pry-byebug (3.11.0)
|
129
158
|
byebug (~> 12.0)
|
130
159
|
pry (>= 0.13, < 0.16)
|
160
|
+
psych (5.2.6)
|
161
|
+
date
|
162
|
+
stringio
|
131
163
|
racc (1.8.1)
|
132
|
-
rack (
|
164
|
+
rack (3.2.0)
|
165
|
+
rack-session (2.1.1)
|
166
|
+
base64 (>= 0.1.0)
|
167
|
+
rack (>= 3.0.0)
|
133
168
|
rack-test (2.2.0)
|
134
169
|
rack (>= 1.3)
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
170
|
+
rackup (2.2.1)
|
171
|
+
rack (>= 3)
|
172
|
+
rails (7.1.5.1)
|
173
|
+
actioncable (= 7.1.5.1)
|
174
|
+
actionmailbox (= 7.1.5.1)
|
175
|
+
actionmailer (= 7.1.5.1)
|
176
|
+
actionpack (= 7.1.5.1)
|
177
|
+
actiontext (= 7.1.5.1)
|
178
|
+
actionview (= 7.1.5.1)
|
179
|
+
activejob (= 7.1.5.1)
|
180
|
+
activemodel (= 7.1.5.1)
|
181
|
+
activerecord (= 7.1.5.1)
|
182
|
+
activestorage (= 7.1.5.1)
|
183
|
+
activesupport (= 7.1.5.1)
|
147
184
|
bundler (>= 1.15.0)
|
148
|
-
railties (= 7.
|
185
|
+
railties (= 7.1.5.1)
|
149
186
|
rails-dom-testing (2.3.0)
|
150
187
|
activesupport (>= 5.0.0)
|
151
188
|
minitest
|
@@ -153,27 +190,35 @@ GEM
|
|
153
190
|
rails-html-sanitizer (1.6.2)
|
154
191
|
loofah (~> 2.21)
|
155
192
|
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
156
|
-
railties (7.
|
157
|
-
actionpack (= 7.
|
158
|
-
activesupport (= 7.
|
159
|
-
|
193
|
+
railties (7.1.5.1)
|
194
|
+
actionpack (= 7.1.5.1)
|
195
|
+
activesupport (= 7.1.5.1)
|
196
|
+
irb
|
197
|
+
rackup (>= 1.0.0)
|
160
198
|
rake (>= 12.2)
|
161
|
-
thor (~> 1.0)
|
162
|
-
zeitwerk (~> 2.
|
199
|
+
thor (~> 1.0, >= 1.2.2)
|
200
|
+
zeitwerk (~> 2.6)
|
163
201
|
rake (13.3.0)
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
202
|
+
rdoc (6.14.2)
|
203
|
+
erb
|
204
|
+
psych (>= 4.0.0)
|
205
|
+
reline (0.6.2)
|
206
|
+
io-console (~> 0.5)
|
207
|
+
rspec (3.12.0)
|
208
|
+
rspec-core (~> 3.12.0)
|
209
|
+
rspec-expectations (~> 3.12.0)
|
210
|
+
rspec-mocks (~> 3.12.0)
|
211
|
+
rspec-core (3.12.3)
|
212
|
+
rspec-support (~> 3.12.0)
|
213
|
+
rspec-expectations (3.12.4)
|
171
214
|
diff-lcs (>= 1.2.0, < 2.0)
|
172
|
-
rspec-support (~> 3.
|
173
|
-
rspec-mocks (3.
|
215
|
+
rspec-support (~> 3.12.0)
|
216
|
+
rspec-mocks (3.12.7)
|
174
217
|
diff-lcs (>= 1.2.0, < 2.0)
|
175
|
-
rspec-support (~> 3.
|
176
|
-
rspec-support (3.
|
218
|
+
rspec-support (~> 3.12.0)
|
219
|
+
rspec-support (3.12.2)
|
220
|
+
securerandom (0.4.1)
|
221
|
+
stringio (3.1.7)
|
177
222
|
thor (1.4.0)
|
178
223
|
timeout (0.4.3)
|
179
224
|
tzinfo (2.0.6)
|
@@ -196,7 +241,7 @@ DEPENDENCIES
|
|
196
241
|
pry
|
197
242
|
pry-byebug
|
198
243
|
rake
|
199
|
-
rspec
|
244
|
+
rspec (~> 3.12.0)
|
200
245
|
|
201
246
|
BUNDLED WITH
|
202
|
-
2.
|
247
|
+
2.6.9
|
data/fibered_mysql2.gemspec
CHANGED
data/gemfiles/rails_7_0.gemfile
CHANGED
@@ -4,13 +4,15 @@ source "https://rubygems.org"
|
|
4
4
|
|
5
5
|
gem "appraisal"
|
6
6
|
gem "appraisal-matrix"
|
7
|
-
gem "coveralls", require: false
|
8
7
|
gem "mysql2", "~> 0.5"
|
9
8
|
gem "nokogiri"
|
10
9
|
gem "pry"
|
11
10
|
gem "pry-byebug"
|
12
11
|
gem "rake"
|
13
|
-
gem "rspec"
|
12
|
+
gem "rspec", "~> 3.12.0"
|
14
13
|
gem "rails", "~> 7.0.0"
|
14
|
+
gem "mutex_m"
|
15
|
+
gem "base64"
|
16
|
+
gem "bigdecimal"
|
15
17
|
|
16
18
|
gemspec path: "../"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal"
|
6
|
+
gem "appraisal-matrix"
|
7
|
+
gem "mysql2", "~> 0.5"
|
8
|
+
gem "nokogiri"
|
9
|
+
gem "pry"
|
10
|
+
gem "pry-byebug"
|
11
|
+
gem "rake"
|
12
|
+
gem "rspec", "~> 3.12.0"
|
13
|
+
gem "rails", "~> 7.1.0"
|
14
|
+
|
15
|
+
gemspec path: "../"
|
@@ -3,11 +3,12 @@
|
|
3
3
|
require 'em-synchrony'
|
4
4
|
require 'active_model'
|
5
5
|
require 'active_record/errors'
|
6
|
+
|
6
7
|
require 'active_record/connection_adapters/mysql2_adapter'
|
7
8
|
require 'em-synchrony/mysql2'
|
8
9
|
|
9
10
|
module FiberedMysql2
|
10
|
-
module
|
11
|
+
module FiberedMysql2Adapter_7_0
|
11
12
|
def lease
|
12
13
|
if in_use?
|
13
14
|
msg = "Cannot lease connection, ".dup
|
@@ -63,7 +64,9 @@ module FiberedMysql2
|
|
63
64
|
end
|
64
65
|
|
65
66
|
class FiberedMysql2Adapter < ::ActiveRecord::ConnectionAdapters::Mysql2Adapter
|
66
|
-
|
67
|
+
if ::ActiveRecord.gem_version < "7.1"
|
68
|
+
include FiberedMysql2Adapter_7_0
|
69
|
+
end
|
67
70
|
|
68
71
|
class << self
|
69
72
|
# Copied from Mysql2Adapter, except with the EM Mysql2 client
|
@@ -77,9 +80,5 @@ module FiberedMysql2
|
|
77
80
|
end
|
78
81
|
end
|
79
82
|
end
|
80
|
-
|
81
|
-
def initialize(*args)
|
82
|
-
super
|
83
|
-
end
|
84
83
|
end
|
85
84
|
end
|
@@ -184,8 +184,6 @@ module FiberedMysql2
|
|
184
184
|
end
|
185
185
|
|
186
186
|
module FiberedDatabaseConnectionPool
|
187
|
-
include FiberedMonitorMixin
|
188
|
-
|
189
187
|
module Adapter_7_0
|
190
188
|
def release_connection(owner_thread = Fiber.current)
|
191
189
|
if (conn = @thread_cached_conns.delete(connection_cache_key(owner_thread)))
|
@@ -194,7 +192,7 @@ module FiberedMysql2
|
|
194
192
|
end
|
195
193
|
|
196
194
|
def with_connection
|
197
|
-
unless (conn = cached_connections[current_connection_id])
|
195
|
+
unless (conn = cached_connections[current_connection_id]) # Invoca Patch to use Fiber
|
198
196
|
conn = connection
|
199
197
|
fresh_connection = true
|
200
198
|
end
|
@@ -203,13 +201,19 @@ module FiberedMysql2
|
|
203
201
|
release_connection if fresh_connection
|
204
202
|
end
|
205
203
|
|
206
|
-
private
|
207
|
-
|
208
204
|
def current_thread
|
209
205
|
Fiber.current
|
210
206
|
end
|
207
|
+
|
208
|
+
def connection
|
209
|
+
cached_connections[current_connection_id] ||= checkout
|
210
|
+
end
|
211
211
|
end
|
212
|
-
|
212
|
+
|
213
|
+
if ::ActiveRecord.gem_version < "7.1"
|
214
|
+
include Adapter_7_0
|
215
|
+
end
|
216
|
+
include FiberedMonitorMixin # This is switches the connection pool's mutex and condition variables to event machine / Fiber compatible ones.
|
213
217
|
|
214
218
|
def initialize(pool_config)
|
215
219
|
if pool_config.db_config.reaping_frequency
|
@@ -221,46 +225,24 @@ module FiberedMysql2
|
|
221
225
|
@reaper = nil # no need to keep a reference to this since it does nothing in this sub-class
|
222
226
|
end
|
223
227
|
|
224
|
-
def
|
225
|
-
|
226
|
-
# (ThreadSafe::Cache's lookups have volatile semantics)
|
227
|
-
if (result = cached_connections[current_connection_id])
|
228
|
-
result
|
229
|
-
else
|
230
|
-
synchronize do
|
231
|
-
if (result = cached_connections[current_connection_id])
|
232
|
-
result
|
233
|
-
else
|
234
|
-
cached_connections[current_connection_id] = checkout
|
235
|
-
end
|
236
|
-
end
|
237
|
-
end
|
228
|
+
def current_connection_id
|
229
|
+
connection_cache_key(current_thread)
|
238
230
|
end
|
239
231
|
|
232
|
+
def cached_connections
|
233
|
+
@thread_cached_conns
|
234
|
+
end
|
235
|
+
|
236
|
+
# Invoca patch that reaps orphaned connections on checkout. This lets us immediately use a connection left open by dead fibers
|
237
|
+
# instead of waiting for all connections to be used in the pool before they are reaped.
|
240
238
|
def checkout(checkout_timeout = @checkout_timeout)
|
241
239
|
begin
|
242
|
-
|
240
|
+
reap
|
243
241
|
rescue => ex
|
244
242
|
ActiveRecord::Base.logger.error("Exception occurred while executing reap_connections: #{ex}")
|
245
243
|
end
|
246
244
|
super
|
247
245
|
end
|
248
|
-
|
249
|
-
def cached_connections
|
250
|
-
@thread_cached_conns
|
251
|
-
end
|
252
|
-
|
253
|
-
def current_connection_id
|
254
|
-
connection_cache_key(current_thread)
|
255
|
-
end
|
256
|
-
|
257
|
-
def reap_connections
|
258
|
-
cached_connections.values.each do |connection|
|
259
|
-
unless connection.owner.alive?
|
260
|
-
checkin(connection)
|
261
|
-
end
|
262
|
-
end
|
263
|
-
end
|
264
246
|
end
|
265
247
|
end
|
266
248
|
|
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.
|
4
|
+
version: 0.4.0.pre.tstarck.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: 2025-08-
|
11
|
+
date: 2025-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: em-synchrony
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: '7.0'
|
34
34
|
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: '7.
|
36
|
+
version: '7.2'
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '7.0'
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '7.
|
46
|
+
version: '7.2'
|
47
47
|
description:
|
48
48
|
email:
|
49
49
|
- development@invoca.com
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- fibered_mysql2.gemspec
|
68
68
|
- gemfiles/.bundle/config
|
69
69
|
- gemfiles/rails_7_0.gemfile
|
70
|
+
- gemfiles/rails_7_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
|
@@ -90,11 +91,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
91
|
version: '0'
|
91
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
93
|
requirements:
|
93
|
-
- - "
|
94
|
+
- - ">="
|
94
95
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
96
|
+
version: '0'
|
96
97
|
requirements: []
|
97
|
-
rubygems_version: 3.
|
98
|
+
rubygems_version: 3.5.22
|
98
99
|
signing_key:
|
99
100
|
specification_version: 4
|
100
101
|
summary: An adapter for fibered mysql2
|