activerecord-turntable 4.4.0 → 4.4.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2707b7fb927d92576addebf9aea39a01bc9d926186f4c3325f201d6c9736c54e
|
4
|
+
data.tar.gz: 6832f239569dcc570eb2f27ddcc7558a32412a41f7b040f55492d4f310b21f36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a125f0773e370a2843eda9af85e058e5739e5727d8bd3707ca63bb1288948395ab1501ff8ebb2542eacde3390a46126d22d7bc714123a6dcae66a2b730766c0
|
7
|
+
data.tar.gz: 9f757cf609f41a9dab3f27b10bd59cf33f726dae96a925642cb5d5d32f816610c2f08c68c1b14b69c3fbbd7881366b5950be7c299abed4fd4c0f9749adf10533
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,28 +1,14 @@
|
|
1
1
|
module ActiveRecord::Turntable
|
2
2
|
module ActiveRecordExt
|
3
3
|
module ConnectionHandlerExtension
|
4
|
+
def owner_to_turntable_pool
|
5
|
+
@owner_to_turntable_pool ||= Concurrent::Map.new(initial_capacity: 2)
|
6
|
+
end
|
7
|
+
|
4
8
|
# @note Override not to establish_connection destroy existing connection pool proxy object
|
5
9
|
def retrieve_connection_pool(spec_name)
|
6
|
-
|
7
|
-
|
8
|
-
# which may have been forked.
|
9
|
-
if ancestor_pool = pool_from_any_process_for(spec_name)
|
10
|
-
if ancestor_pool.is_a?(ActiveRecord::ConnectionAdapters::ConnectionPool)
|
11
|
-
# A connection was established in an ancestor process that must have
|
12
|
-
# subsequently forked. We can't reuse the connection, but we can copy
|
13
|
-
# the specification and establish a new connection with it.
|
14
|
-
spec = ancestor_pool.spec
|
15
|
-
spec = spec.to_hash if spec.respond_to?(:to_hash)
|
16
|
-
establish_connection(spec).tap do |pool|
|
17
|
-
pool.schema_cache = ancestor_pool.schema_cache if ancestor_pool.schema_cache
|
18
|
-
end
|
19
|
-
else
|
20
|
-
# Use same PoolProxy object
|
21
|
-
owner_to_pool[spec_name] = ancestor_pool
|
22
|
-
end
|
23
|
-
else
|
24
|
-
owner_to_pool[spec_name] = nil
|
25
|
-
end
|
10
|
+
owner_to_turntable_pool.fetch(spec_name) do
|
11
|
+
super
|
26
12
|
end
|
27
13
|
end
|
28
14
|
end
|
@@ -61,7 +61,7 @@ module ActiveRecord::Turntable
|
|
61
61
|
pp = PoolProxy.new(cp)
|
62
62
|
|
63
63
|
self.connection_specification_name = "turntable_pool_proxy::#{name}"
|
64
|
-
ch.
|
64
|
+
ch.owner_to_turntable_pool[connection_specification_name] = pp
|
65
65
|
end
|
66
66
|
|
67
67
|
def sequencer(sequencer_name, *args)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-turntable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.4.
|
4
|
+
version: 4.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gussan
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-11-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|