fibered_mysql2 1.0.0.colin.1 → 1.0.0.colin.2

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: 4eb4eb8b784857e027f0d40f7f43e96e65b0bf442153831bc07be41030ae646d
4
+ data.tar.gz: e1ddc3b9ef66c848cb66b7fd080cd90aef0d6a40fa658ddd6abc1cd39c4ff409
5
5
  SHA512:
6
- metadata.gz: 9a21b639b0b0ab6afcb558978a7e1060510e7fc7ca5e9a833b27d2b8c9eb49d023ac5beb5e0c500c3a3ff711d7f6ee0e49ae61f4e72f941c7a07420f60b9c866
7
- data.tar.gz: 99adce5422229bdea37a08ed76a4dad71c6f4108ce3588d42dadc3b6c6fbb2895f65532842739dbe83cd7d6c748ea4b0cf7d57d05ca8fc26cbd0c6e65ab17e41
6
+ metadata.gz: f6eb1d2947a2b8c2abcb117f39a888139683206dde1f7d6259fb0aa864b6cfae03939d69b7fb22965d464702fed0efddd8db1c1e8d5141dff79e9feaa4bc05c4
7
+ data.tar.gz: ec9ee0570f5e99ddc6add3d86589ce0534ed624cf1ae4daf33f4ae65ba46a251f015c34ff845064fddaf73290ba645cb53e45dce0e53c4fc8a7c029bc2b47262
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.2)
5
5
  async
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.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
@@ -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,9 +53,9 @@ 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
@@ -1,9 +1,6 @@
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
@@ -30,8 +27,8 @@ module FiberedMysql2
30
27
  super
31
28
  end
32
29
 
33
- def release_connection(owner_task = AsyncTask.current_or_none)
34
- if (conn = @thread_cached_conns.delete(connection_cache_key(owner_task)))
30
+ def release_connection(owner = Fiber.current)
31
+ if (conn = @thread_cached_conns.delete(connection_cache_key(owner)))
35
32
  checkin(conn)
36
33
  end
37
34
  end
@@ -81,7 +78,7 @@ module FiberedMysql2
81
78
  end
82
79
 
83
80
  def current_thread
84
- AsyncTask.current_or_none
81
+ Fiber.current
85
82
  end
86
83
  end
87
84
  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.2"
5
5
  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: 1.0.0.colin.1
4
+ version: 1.0.0.colin.2
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-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async