fibered_mysql2 1.0.0.colin.1 → 1.0.0.colin.3

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: 75d1eaf3701caa8823cdfbec61e7d9734d1e5f463e7936010c5636715591c2c9
4
- data.tar.gz: 715db9f2e07df69a6cf51a2389404f030cd9c257524544cb77c16f53de36b944
3
+ metadata.gz: 1edbb420eedd78ecab2ae0fef48554d968f01e44c791430262f55b43c280dea0
4
+ data.tar.gz: 676673438f5078176bfbd836d6e34d79283a1aa8874cbd32563266dbf163a5b3
5
5
  SHA512:
6
- metadata.gz: 9a21b639b0b0ab6afcb558978a7e1060510e7fc7ca5e9a833b27d2b8c9eb49d023ac5beb5e0c500c3a3ff711d7f6ee0e49ae61f4e72f941c7a07420f60b9c866
7
- data.tar.gz: 99adce5422229bdea37a08ed76a4dad71c6f4108ce3588d42dadc3b6c6fbb2895f65532842739dbe83cd7d6c748ea4b0cf7d57d05ca8fc26cbd0c6e65ab17e41
6
+ metadata.gz: a6de1e7d5bd5afe99bb1104d772dcef36bf5414d58e57b069bf2883e506c1a5f78551a429b4ee3098321373bee5ff83ee2a200ba3477ebde9bd15d26cd78fa4f
7
+ data.tar.gz: e506a05e2ffd01f2c0f7380a9fd644735aceb9843f43f683b1972533f5c37d783ef4aa2b8417aa9e25ef548c03bc837fec7aeb9b16a0e000d6683ab6619d3bf7
@@ -8,10 +8,9 @@ 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]
12
12
  gemfile:
13
13
  - Gemfile
14
- - gemfiles/rails_5.gemfile
15
14
  - gemfiles/rails_6.gemfile
16
15
  env:
17
16
  BUNDLE_GEMFILE: ${{ matrix.gemfile }}
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
6
-
7
3
  appraise 'rails-6' do
8
4
  gem 'rails', '~> 6.0.0'
9
5
  end
data/Gemfile.lock CHANGED
@@ -1,69 +1,69 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fibered_mysql2 (1.0.0.colin.1)
4
+ fibered_mysql2 (1.0.0.colin.3)
5
5
  async
6
- rails (>= 5.2, < 7)
6
+ rails (>= 6, < 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.0.6.1)
12
+ actionpack (= 6.0.6.1)
13
13
  nio4r (~> 2.0)
14
14
  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)
15
+ actionmailbox (6.0.6.1)
16
+ actionpack (= 6.0.6.1)
17
+ activejob (= 6.0.6.1)
18
+ activerecord (= 6.0.6.1)
19
+ activestorage (= 6.0.6.1)
20
+ activesupport (= 6.0.6.1)
21
21
  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)
22
+ actionmailer (6.0.6.1)
23
+ actionpack (= 6.0.6.1)
24
+ actionview (= 6.0.6.1)
25
+ activejob (= 6.0.6.1)
26
26
  mail (~> 2.5, >= 2.5.4)
27
27
  rails-dom-testing (~> 2.0)
28
- actionpack (6.0.3.4)
29
- actionview (= 6.0.3.4)
30
- activesupport (= 6.0.3.4)
28
+ actionpack (6.0.6.1)
29
+ actionview (= 6.0.6.1)
30
+ activesupport (= 6.0.6.1)
31
31
  rack (~> 2.0, >= 2.0.8)
32
32
  rack-test (>= 0.6.3)
33
33
  rails-dom-testing (~> 2.0)
34
34
  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)
35
+ actiontext (6.0.6.1)
36
+ actionpack (= 6.0.6.1)
37
+ activerecord (= 6.0.6.1)
38
+ activestorage (= 6.0.6.1)
39
+ activesupport (= 6.0.6.1)
40
40
  nokogiri (>= 1.8.5)
41
- actionview (6.0.3.4)
42
- activesupport (= 6.0.3.4)
41
+ actionview (6.0.6.1)
42
+ activesupport (= 6.0.6.1)
43
43
  builder (~> 3.1)
44
44
  erubi (~> 1.4)
45
45
  rails-dom-testing (~> 2.0)
46
46
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
47
- activejob (6.0.3.4)
48
- activesupport (= 6.0.3.4)
47
+ activejob (6.0.6.1)
48
+ activesupport (= 6.0.6.1)
49
49
  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)
50
+ activemodel (6.0.6.1)
51
+ activesupport (= 6.0.6.1)
52
+ activerecord (6.0.6.1)
53
+ activemodel (= 6.0.6.1)
54
+ activesupport (= 6.0.6.1)
55
+ activestorage (6.0.6.1)
56
+ actionpack (= 6.0.6.1)
57
+ activejob (= 6.0.6.1)
58
+ activerecord (= 6.0.6.1)
59
+ marcel (~> 1.0)
60
+ activesupport (6.0.6.1)
61
61
  concurrent-ruby (~> 1.0, >= 1.0.2)
62
62
  i18n (>= 0.7, < 2)
63
63
  minitest (~> 5.1)
64
64
  tzinfo (~> 1.1)
65
65
  zeitwerk (~> 2.2, >= 2.2.2)
66
- appraisal (2.4.0)
66
+ appraisal (2.4.1)
67
67
  bundler
68
68
  rake
69
69
  thor (>= 0.14.0)
@@ -74,7 +74,7 @@ GEM
74
74
  builder (3.2.4)
75
75
  byebug (11.1.3)
76
76
  coderay (1.1.3)
77
- concurrent-ruby (1.1.8)
77
+ concurrent-ruby (1.2.2)
78
78
  console (1.16.2)
79
79
  fiber-local
80
80
  coveralls (0.8.23)
@@ -84,111 +84,121 @@ GEM
84
84
  thor (>= 0.19.4, < 2.0)
85
85
  tins (~> 1.6)
86
86
  crass (1.0.6)
87
- diff-lcs (1.4.4)
88
- docile (1.3.2)
89
- erubi (1.10.0)
87
+ date (3.3.3)
88
+ diff-lcs (1.5.0)
89
+ docile (1.4.0)
90
+ erubi (1.12.0)
90
91
  fiber-local (1.0.0)
91
- globalid (0.4.2)
92
- activesupport (>= 4.2.0)
93
- i18n (1.8.7)
92
+ globalid (1.1.0)
93
+ activesupport (>= 5.0)
94
+ i18n (1.13.0)
94
95
  concurrent-ruby (~> 1.0)
95
96
  io-event (1.2.2)
96
- json (2.3.1)
97
- loofah (2.8.0)
97
+ json (2.6.3)
98
+ loofah (2.21.3)
98
99
  crass (~> 1.0.2)
99
- nokogiri (>= 1.5.9)
100
- mail (2.7.1)
100
+ nokogiri (>= 1.12.0)
101
+ mail (2.8.1)
101
102
  mini_mime (>= 0.1.1)
102
- marcel (0.3.3)
103
- mimemagic (~> 0.3.2)
103
+ net-imap
104
+ net-pop
105
+ net-smtp
106
+ marcel (1.0.2)
104
107
  method_source (1.0.0)
105
- mimemagic (0.3.10)
106
- nokogiri (~> 1)
107
- rake
108
- mini_mime (1.0.2)
108
+ mini_mime (1.1.2)
109
109
  mini_portile2 (2.6.1)
110
- minitest (5.14.3)
110
+ minitest (5.18.0)
111
111
  mysql2 (0.5.5)
112
- nio4r (2.5.4)
112
+ net-imap (0.3.4)
113
+ date
114
+ net-protocol
115
+ net-pop (0.1.2)
116
+ net-protocol
117
+ net-protocol (0.2.1)
118
+ timeout
119
+ net-smtp (0.3.3)
120
+ net-protocol
121
+ nio4r (2.5.9)
113
122
  nokogiri (1.12.5)
114
123
  mini_portile2 (~> 2.6.1)
115
124
  racc (~> 1.4)
116
- pry (0.13.1)
125
+ pry (0.14.2)
117
126
  coderay (~> 1.1)
118
127
  method_source (~> 1.0)
119
- pry-byebug (3.9.0)
128
+ pry-byebug (3.10.1)
120
129
  byebug (~> 11.0)
121
- pry (~> 0.13.0)
122
- racc (1.6.0)
123
- rack (2.2.3)
124
- rack-test (1.1.0)
125
- rack (>= 1.0, < 3)
126
- rails (6.0.3.4)
127
- actioncable (= 6.0.3.4)
128
- actionmailbox (= 6.0.3.4)
129
- actionmailer (= 6.0.3.4)
130
- actionpack (= 6.0.3.4)
131
- actiontext (= 6.0.3.4)
132
- actionview (= 6.0.3.4)
133
- activejob (= 6.0.3.4)
134
- activemodel (= 6.0.3.4)
135
- activerecord (= 6.0.3.4)
136
- activestorage (= 6.0.3.4)
137
- activesupport (= 6.0.3.4)
130
+ pry (>= 0.13, < 0.15)
131
+ racc (1.6.2)
132
+ rack (2.2.7)
133
+ rack-test (2.1.0)
134
+ rack (>= 1.3)
135
+ rails (6.0.6.1)
136
+ actioncable (= 6.0.6.1)
137
+ actionmailbox (= 6.0.6.1)
138
+ actionmailer (= 6.0.6.1)
139
+ actionpack (= 6.0.6.1)
140
+ actiontext (= 6.0.6.1)
141
+ actionview (= 6.0.6.1)
142
+ activejob (= 6.0.6.1)
143
+ activemodel (= 6.0.6.1)
144
+ activerecord (= 6.0.6.1)
145
+ activestorage (= 6.0.6.1)
146
+ activesupport (= 6.0.6.1)
138
147
  bundler (>= 1.3.0)
139
- railties (= 6.0.3.4)
148
+ railties (= 6.0.6.1)
140
149
  sprockets-rails (>= 2.0.0)
141
150
  rails-dom-testing (2.0.3)
142
151
  activesupport (>= 4.2.0)
143
152
  nokogiri (>= 1.6)
144
- rails-html-sanitizer (1.3.0)
145
- loofah (~> 2.3)
146
- railties (6.0.3.4)
147
- actionpack (= 6.0.3.4)
148
- activesupport (= 6.0.3.4)
153
+ rails-html-sanitizer (1.5.0)
154
+ loofah (~> 2.19, >= 2.19.1)
155
+ railties (6.0.6.1)
156
+ actionpack (= 6.0.6.1)
157
+ activesupport (= 6.0.6.1)
149
158
  method_source
150
159
  rake (>= 0.8.7)
151
160
  thor (>= 0.20.3, < 2.0)
152
161
  rake (13.0.6)
153
- rspec (3.9.0)
154
- rspec-core (~> 3.9.0)
155
- rspec-expectations (~> 3.9.0)
156
- rspec-mocks (~> 3.9.0)
157
- rspec-core (3.9.3)
158
- rspec-support (~> 3.9.3)
159
- rspec-expectations (3.9.2)
162
+ rspec (3.12.0)
163
+ rspec-core (~> 3.12.0)
164
+ rspec-expectations (~> 3.12.0)
165
+ rspec-mocks (~> 3.12.0)
166
+ rspec-core (3.12.2)
167
+ rspec-support (~> 3.12.0)
168
+ rspec-expectations (3.12.3)
160
169
  diff-lcs (>= 1.2.0, < 2.0)
161
- rspec-support (~> 3.9.0)
162
- rspec-mocks (3.9.1)
170
+ rspec-support (~> 3.12.0)
171
+ rspec-mocks (3.12.5)
163
172
  diff-lcs (>= 1.2.0, < 2.0)
164
- rspec-support (~> 3.9.0)
165
- rspec-support (3.9.3)
173
+ rspec-support (~> 3.12.0)
174
+ rspec-support (3.12.0)
166
175
  simplecov (0.16.1)
167
176
  docile (~> 1.1)
168
177
  json (>= 1.8, < 3)
169
178
  simplecov-html (~> 0.10.0)
170
179
  simplecov-html (0.10.2)
171
- sprockets (4.0.2)
180
+ sprockets (4.2.0)
172
181
  concurrent-ruby (~> 1.0)
173
- rack (> 1, < 3)
174
- sprockets-rails (3.2.2)
175
- actionpack (>= 4.0)
176
- activesupport (>= 4.0)
182
+ rack (>= 2.2.4, < 4)
183
+ sprockets-rails (3.4.2)
184
+ actionpack (>= 5.2)
185
+ activesupport (>= 5.2)
177
186
  sprockets (>= 3.0.0)
178
187
  sync (0.5.0)
179
188
  term-ansicolor (1.7.1)
180
189
  tins (~> 1.0)
181
- thor (1.0.1)
190
+ thor (1.2.2)
182
191
  thread_safe (0.3.6)
192
+ timeout (0.3.2)
183
193
  timers (4.3.5)
184
- tins (1.25.0)
194
+ tins (1.32.1)
185
195
  sync
186
- tzinfo (1.2.9)
196
+ tzinfo (1.2.11)
187
197
  thread_safe (~> 0.1)
188
- websocket-driver (0.7.3)
198
+ websocket-driver (0.7.5)
189
199
  websocket-extensions (>= 0.1.0)
190
200
  websocket-extensions (0.1.5)
191
- zeitwerk (2.4.1)
201
+ zeitwerk (2.6.8)
192
202
 
193
203
  PLATFORMS
194
204
  ruby
data/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  # FiberedMysql2
4
4
 
5
- FiberedMysql2 adds Fiber support to `ActiveRecord::ConnectionAdapters::EMMysql2Adapter`
5
+ FiberedMysql2 adds Fiber support to `ActiveRecord::ConnectionAdapters::Mysql2Adapter` for Rails 6.
6
+ This is a stop-gap until Rails 7, which adds `isolation_level: :fiber` to `ActiveRecord`.
6
7
 
7
8
  ## Installation
8
9
 
@@ -21,15 +22,15 @@ Or install it yourself as:
21
22
  $ gem install fibered_mysql2
22
23
 
23
24
  ## Support
24
- Tested with Rails versions 5.2 and 6.0.
25
+ Tested with Rails 6.0, Ruby 3, and Async.
25
26
 
26
27
  ## Usage
27
28
 
28
- Behaves the same as `ActiveRecord::ConnectionAdapters::EMMysql2Adapter` but with added Fiber safety while leasing/expiring connections.
29
+ Behaves the same as `ActiveRecord::ConnectionAdapters::Mysql2Adapter` but with using Fibers rather than Threads for tracking ownership when leasing/expiring connections.
29
30
  ```ruby
30
31
  connection = FiberedMysql2::FiberedMysql2Adapter.new(client, logger, options, config)
31
32
  connection.lease
32
- connection.expire # Rails 5+ only
33
+ connection.expire
33
34
  ```
34
35
 
35
36
  ## Development
data/bin/console CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
+ require "active_record"
4
5
  require "fibered_mysql2"
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
@@ -30,5 +30,5 @@ Gem::Specification.new do |spec|
30
30
  spec.require_paths = ["lib"]
31
31
 
32
32
  spec.add_dependency 'async'
33
- spec.add_dependency 'rails', '>= 5.2', '< 7'
33
+ spec.add_dependency 'rails', '>= 6', '< 7'
34
34
  end
@@ -3,34 +3,33 @@
3
3
  require 'active_model'
4
4
  require 'active_record/errors'
5
5
  require 'active_record/connection_adapters/mysql2_adapter'
6
- require_relative '../../fibered_mysql2/async_task'
7
6
 
8
7
  module FiberedMysql2
9
8
  module FiberedMysql2Adapter_6
10
9
  def lease
11
- if (ot = owner_task)
10
+ if (of = owner_fiber)
12
11
  msg = +"Cannot lease connection; "
13
- if ot == (current_task = AsyncTask.current_or_none)
14
- msg << "it is already leased by the current Async::Task."
12
+ if of == Fiber.current
13
+ msg << "it is already leased by the current Fiber."
15
14
  else
16
- msg << "it is already in use by a different Async::Task: #{ot}. " \
17
- "Current Async::Task: #{current_task}."
15
+ msg << "it is already in use by a different Fiber: #{of}. " \
16
+ "Current Fiber: #{Fiber.current}."
18
17
  end
19
18
  raise ::ActiveRecord::ActiveRecordError, msg
20
19
  end
21
20
 
22
- @owner = AsyncTask.current_or_none
21
+ @owner = Fiber.current
23
22
  end
24
23
 
25
24
  def expire
26
- if (ot = owner_task)
27
- # Because we are actively releasing connections from dead tasks, we only want
28
- # to enforce that we're expiring the current task's connection, iff the owner
25
+ if (of = owner_fiber)
26
+ # Because we are actively releasing connections from dead fibers, we only want
27
+ # to enforce that we're expiring the current fiber's connection, iff the owner
29
28
  # of the connection is still alive.
30
- if ot.alive? && ot != (current_task = AsyncTask.current_or_none)
29
+ if of.alive? && of != Fiber.current
31
30
  raise ::ActiveRecord::ActiveRecordError, "Cannot expire connection; " \
32
- "it is owned by a different Async::Task: #{ot}. " \
33
- "Current Async::Task: #{current_task}."
31
+ "it is owned by a different Fiber: #{of}. " \
32
+ "Current Fiber: #{Fiber.current}."
34
33
  end
35
34
 
36
35
  @idle_since = ::Concurrent.monotonic_time
@@ -41,11 +40,11 @@ module FiberedMysql2
41
40
  end
42
41
 
43
42
  def steal!
44
- if (ot = owner_task)
45
- if ot != (current_task = AsyncTask.current_or_none)
46
- pool.send :remove_connection_from_thread_cache, self, ot
43
+ if (of = owner_fiber)
44
+ if of != Fiber.current
45
+ pool.send :remove_connection_from_thread_cache, self, of
47
46
 
48
- @owner = current_task
47
+ @owner = Fiber.current
49
48
  end
50
49
  else
51
50
  raise ::ActiveRecord::ActiveRecordError, "Cannot steal connection; it is not currently leased."
@@ -54,20 +53,17 @@ module FiberedMysql2
54
53
 
55
54
  private
56
55
 
57
- def owner_task
58
- @owner.nil? || @owner == AsyncTask::NoTaskPlaceholder || @owner.is_a?(Async::Task) or
59
- raise "@owner must be an Async::Task or FiberedMysql2::AsyncTask::NoTaskPlaceholder! Found #{@owner.inspect}"
56
+ def owner_fiber
57
+ @owner.nil? || @owner.is_a?(Fiber) or
58
+ raise "@owner must be a Fiber! Found #{@owner.inspect}"
60
59
  @owner
61
60
  end
62
61
  end
63
62
 
64
63
  class FiberedMysql2Adapter < ::ActiveRecord::ConnectionAdapters::Mysql2Adapter
65
- case ::Rails::VERSION::MAJOR
66
- when 6
67
- include FiberedMysql2Adapter_6
68
- else
69
- raise ArgumentError, "unexpected Rails version #{Rails::VERSION::MAJOR}"
70
- end
64
+ ActiveRecord::VERSION::MAJOR == 6 or raise ArgumentError, "unexpected Rails version #{ActiveRecord::VERSION::MAJOR}"
65
+
66
+ include FiberedMysql2Adapter_6
71
67
 
72
68
  def initialize(*args)
73
69
  super
@@ -1,17 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # This class behaves the same as ActiveRecord's ConnectionPool, but synchronizes with Async::Task fibers rather than threads.
4
-
5
- # Note - trace statements have been commented out. This is useful trace but we do not want it on by default.
6
- # When we have configurable logging we can put this back and have it off by default.
3
+ # This class behaves the same as ActiveRecord's ConnectionPool, but synchronizes with fibers rather than threads.
7
4
 
8
5
  module FiberedMysql2
9
6
  module FiberedDatabaseConnectionPool
10
- case ::Rails::VERSION::MAJOR
11
- when 6
12
- else
13
- raise ArgumentError, "unexpected Rails version #{Rails::VERSION::MAJOR}"
14
- end
7
+ ActiveRecord::VERSION::MAJOR == 6 or raise ArgumentError, "unexpected Rails version #{ActiveRecord::VERSION::MAJOR}"
15
8
 
16
9
  def cached_connections
17
10
  @thread_cached_conns
@@ -30,8 +23,8 @@ module FiberedMysql2
30
23
  super
31
24
  end
32
25
 
33
- def release_connection(owner_task = AsyncTask.current_or_none)
34
- if (conn = @thread_cached_conns.delete(connection_cache_key(owner_task)))
26
+ def release_connection(owner = Fiber.current)
27
+ if (conn = @thread_cached_conns.delete(connection_cache_key(owner)))
35
28
  checkin(conn)
36
29
  end
37
30
  end
@@ -81,7 +74,7 @@ module FiberedMysql2
81
74
  end
82
75
 
83
76
  def current_thread
84
- AsyncTask.current_or_none
77
+ Fiber.current
85
78
  end
86
79
  end
87
80
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FiberedMysql2
4
- VERSION = "1.0.0.colin.1"
4
+ VERSION = "1.0.0.colin.3"
5
5
  end
@@ -1,13 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'async'
4
- require 'fibered_mysql2/version'
5
- require_relative '../lib/active_record/connection_adapters/fibered_mysql2_adapter'
6
- require 'fibered_mysql2/fibered_database_connection_pool'
7
- require 'fibered_mysql2/fibered_mutex_with_waiter_priority'
8
- require 'fibered_mysql2/fibered_mysql2_connection_factory'
9
4
 
10
- module FiberedMysql2
11
- class Error < StandardError; end
12
- # Your code goes here...
13
- end
5
+ require_relative 'active_record/connection_adapters/fibered_mysql2_adapter'
6
+ require_relative 'fibered_mysql2/fibered_database_connection_pool'
7
+ require_relative 'fibered_mysql2/fibered_mysql2_connection_factory'
8
+ require_relative 'fibered_mysql2/version'
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: 1.0.0.colin.1
4
+ version: 1.0.0.colin.3
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-05-27 00:00:00.000000000 Z
11
+ date: 2023-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '5.2'
33
+ version: '6'
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
36
  version: '7'
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: '5.2'
43
+ version: '6'
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '7'
@@ -66,13 +66,10 @@ files:
66
66
  - bin/console
67
67
  - bin/setup
68
68
  - fibered_mysql2.gemspec
69
- - gemfiles/rails_5.gemfile
70
69
  - gemfiles/rails_6.gemfile
71
70
  - lib/active_record/connection_adapters/fibered_mysql2_adapter.rb
72
71
  - lib/fibered_mysql2.rb
73
- - lib/fibered_mysql2/async_task.rb
74
72
  - lib/fibered_mysql2/fibered_database_connection_pool.rb
75
- - lib/fibered_mysql2/fibered_mutex_with_waiter_priority.rb
76
73
  - lib/fibered_mysql2/fibered_mysql2_connection_factory.rb
77
74
  - lib/fibered_mysql2/version.rb
78
75
  homepage: https://github.com/Invoca/fibered_mysql2
@@ -1,15 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "appraisal"
6
- gem "coveralls", require: false
7
- 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"
14
-
15
- gemspec path: "../"
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module FiberedMysql2
4
- module AsyncTask
5
- class NoTaskPlaceholder
6
- class << self
7
- def alive? = true
8
- end
9
- end
10
-
11
- class << self
12
- # Adapted from https://github.com/socketry/async/blob/main/lib/async/task.rb#L236-L238
13
- def current_or_none
14
- Thread.current[:async_task] || NoTaskPlaceholder
15
- end
16
- end
17
- end
18
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module FiberedMysql2
4
- module FiberedMutexWithWaiterPriority
5
- # Note: @waiters is a bit confusing because the first waiter is actually the current fiber that has it locked;
6
- # the _rest_ of @waiters are the actual waiters
7
- def sleep(timeout = nil)
8
- unlock
9
- beg = Time.now
10
- current = Fiber.current
11
- @slept[current] = true
12
- if timeout
13
- timer = EM.add_timer(timeout) do
14
- _wakeup(current)
15
- end
16
- Fiber.yield
17
- EM.cancel_timer(timer) # if we resumed not via timer
18
- else
19
- Fiber.yield
20
- end
21
- @slept.delete(current)
22
- yield if block_given?
23
-
24
- # Invoca patch: inline lock that puts us at the front of the mutex @waiters queue instead of the back
25
- # ==========================
26
- @waiters.unshift(current)
27
- Fiber.yield if @waiters.size > 1
28
- # ==========================
29
-
30
- Time.now - beg
31
- end
32
- end
33
- end