fibered_mysql2 0.4.0.pre.tstarck.1 → 0.4.0.pre.tstarck.2
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/Gemfile.lock +1 -1
- data/lib/fibered_mysql2/fibered_database_connection_pool.rb +17 -4
- data/lib/fibered_mysql2/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5804c1cde27f4f2a0d3c222c5f49a207930c140ebc911e71b0b4655925b83917
|
4
|
+
data.tar.gz: dd33b3c3dfba5b858fc2b85832b2d65650661e53513311f9b99a62089dade8c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72b39a4bb7c035e1ab5d7ea7929f51c08d7fd0f7cac223d97444c3352e7bcd0f078d7146a5e2a0f446c1bae69774b0e5246dd77d425a83530e92be02f4215579
|
7
|
+
data.tar.gz: e4ef21a8acd88205f612d0fe23924527d4ed65f78d54ec5a397317c27ab8a1454f17b9979b830a5ffe90ab2478851114305af3706c958f3cbd559ece21adeeb5
|
data/Gemfile.lock
CHANGED
@@ -204,10 +204,6 @@ module FiberedMysql2
|
|
204
204
|
def current_thread
|
205
205
|
Fiber.current
|
206
206
|
end
|
207
|
-
|
208
|
-
def connection
|
209
|
-
cached_connections[current_connection_id] ||= checkout
|
210
|
-
end
|
211
207
|
end
|
212
208
|
|
213
209
|
if ::ActiveRecord.gem_version < "7.1"
|
@@ -243,6 +239,23 @@ module FiberedMysql2
|
|
243
239
|
end
|
244
240
|
super
|
245
241
|
end
|
242
|
+
|
243
|
+
# Invoca patch to ensure that we are using the current fiber's connection.
|
244
|
+
def connection
|
245
|
+
# this is correctly done double-checked locking
|
246
|
+
# (ThreadSafe::Cache's lookups have volatile semantics)
|
247
|
+
if (result = cached_connections[current_connection_id])
|
248
|
+
result
|
249
|
+
else
|
250
|
+
synchronize do
|
251
|
+
if (result = cached_connections[current_connection_id])
|
252
|
+
result
|
253
|
+
else
|
254
|
+
cached_connections[current_connection_id] = checkout
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
246
259
|
end
|
247
260
|
end
|
248
261
|
|