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: 0bb7d81afbaa8937a6f248d0b755e7a00da9d5471d5ec235d9c2bf0db14028d9
4
- data.tar.gz: a67d03e3df1c3084b488f370a517c63e4d209a2590d40602b5ccbff115221997
3
+ metadata.gz: 2707b7fb927d92576addebf9aea39a01bc9d926186f4c3325f201d6c9736c54e
4
+ data.tar.gz: 6832f239569dcc570eb2f27ddcc7558a32412a41f7b040f55492d4f310b21f36
5
5
  SHA512:
6
- metadata.gz: 8609ab1d338c91ae68e5681b6ac5588b5546177e35793363d0b1caaef156953a44a8cf5716dbb6b8702c7e2a3ccc4ea4a6e1cbdfa12e53492e1ab918c7c7ba17
7
- data.tar.gz: 7d917139b63470b12a67e2a3eceaa075845a1510dee2202d067114d3b2ef388bfc8e85fb883b21815f25388c657388707546060055d0a38a6603be02ae499ce7
6
+ metadata.gz: 5a125f0773e370a2843eda9af85e058e5739e5727d8bd3707ca63bb1288948395ab1501ff8ebb2542eacde3390a46126d22d7bc714123a6dcae66a2b730766c0
7
+ data.tar.gz: 9f757cf609f41a9dab3f27b10bd59cf33f726dae96a925642cb5d5d32f816610c2f08c68c1b14b69c3fbbd7881366b5950be7c299abed4fd4c0f9749adf10533
@@ -1,3 +1,9 @@
1
+ ## activerecord-turntable 4.4.1 ##
2
+
3
+ ### Bugfix
4
+
5
+ * Fix performance degragation about handling connection on v4.4.0 and earlier v4 releases.
6
+
1
7
  ## activerecord-turntable 4.4.0 ##
2
8
 
3
9
  ### Major Changes
data/README.md CHANGED
@@ -27,7 +27,7 @@ MySQL only.
27
27
  Add to Gemfile:
28
28
 
29
29
  ```ruby
30
- gem 'activerecord-turntable', '~> 4.4.0'
30
+ gem 'activerecord-turntable', '~> 4.4.1'
31
31
  ```
32
32
 
33
33
  Run a bundle install:
@@ -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
- owner_to_pool.fetch(spec_name) do
7
- # Check if a connection was previously established in an ancestor process,
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.send(:owner_to_pool)[connection_specification_name] = pp
64
+ ch.owner_to_turntable_pool[connection_specification_name] = pp
65
65
  end
66
66
 
67
67
  def sequencer(sequencer_name, *args)
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Turntable
3
- VERSION = "4.4.0".freeze
3
+ VERSION = "4.4.1".freeze
4
4
  end
5
5
  end
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.0
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-10-01 00:00:00.000000000 Z
12
+ date: 2018-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord