activerecord-bogacs 0.3.0 → 0.4.0
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/.travis.yml +16 -10
- data/Gemfile +3 -0
- data/Rakefile +17 -2
- data/activerecord-bogacs.gemspec +7 -5
- data/lib/active_record/bogacs/default_pool.rb +5 -8
- data/lib/active_record/bogacs/false_pool.rb +3 -4
- data/lib/active_record/bogacs/pool_support.rb +3 -3
- data/lib/active_record/bogacs/shareable_pool.rb +13 -20
- data/lib/active_record/bogacs/thread_safe.rb +76 -0
- data/lib/active_record/bogacs/thread_safe/synchronized.rb +33 -0
- data/lib/active_record/bogacs/version.rb +1 -1
- data/test/test_helper.rb +3 -3
- metadata +14 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f7c9f5688cb27fb4c84bea3a516d1d2d014fb1c
|
4
|
+
data.tar.gz: 17a6269479cb432bda7d027c0d89586c6cecaa19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ad54c3ab7af8f4edbc2fea17cba7f1d32d784d4107ba8fe186e58fed676dd30f61b91bef610d3912b9f0bc1022286b39366b8b605228ba9e2c38939f155910b
|
7
|
+
data.tar.gz: 8dffdfc6857d604ab66931b0a30eca0d6e5b5d9fd148ec1dcb73721dd29cf338de3744730974581cb4f624e1cf402e2c1790357201310904e8cdef8787be7d54
|
data/.travis.yml
CHANGED
@@ -5,8 +5,7 @@ jdk:
|
|
5
5
|
- oraclejdk7
|
6
6
|
- oraclejdk8
|
7
7
|
rvm:
|
8
|
-
- jruby-1.7.
|
9
|
-
#- jruby-head
|
8
|
+
- jruby-1.7.22
|
10
9
|
#- 2.1.2
|
11
10
|
before_install:
|
12
11
|
- ((jruby -v | grep 1.8.7) && jruby --1.9 -S gem update --system 2.1.11) || true
|
@@ -21,8 +20,8 @@ script:
|
|
21
20
|
- bundle exec rake dbcp:download
|
22
21
|
- bundle exec rake db:create:mysql db:create:postgresql
|
23
22
|
env:
|
24
|
-
- JRUBY_OPTS="$JRUBY_OPTS" AR_ADAPTER=mysql AR_VERSION="~> 4.1.9" HIKARI_VERSION="2.3.
|
25
|
-
- JRUBY_OPTS="$JRUBY_OPTS" AR_ADAPTER=postgresql AR_VERSION="~> 4.1.9" HIKARI_VERSION="2.3.
|
23
|
+
- JRUBY_OPTS="$JRUBY_OPTS" AR_ADAPTER=mysql AR_VERSION="~> 4.1.9" HIKARI_VERSION="2.3.12"
|
24
|
+
- JRUBY_OPTS="$JRUBY_OPTS" AR_ADAPTER=postgresql AR_VERSION="~> 4.1.9" HIKARI_VERSION="2.3.2-java6"
|
26
25
|
- JRUBY_OPTS="$JRUBY_OPTS" AR_ADAPTER=mysql AR_VERSION="~> 4.1.9" HIKARI_VERSION="2.0.1-java6"
|
27
26
|
- JRUBY_OPTS="$JRUBY_OPTS" AR_ADAPTER=postgresql AR_VERSION="~> 3.2.18" HIKARI_VERSION="1.4.0"
|
28
27
|
- JRUBY_OPTS="--1.8 $JRUBY_OPTS" AR_ADAPTER=mysql AR_VERSION="~> 3.2.18" HIKARI_VERSION="2.2.5-java6"
|
@@ -30,15 +29,22 @@ matrix:
|
|
30
29
|
#allow_failures:
|
31
30
|
#- rvm: jruby-head
|
32
31
|
exclude:
|
33
|
-
- rvm: jruby-1.7.
|
34
|
-
env: JRUBY_OPTS="$JRUBY_OPTS" AR_ADAPTER=mysql AR_VERSION="~> 4.1.9" HIKARI_VERSION="2.3.
|
32
|
+
- rvm: jruby-1.7.22
|
33
|
+
env: JRUBY_OPTS="$JRUBY_OPTS" AR_ADAPTER=mysql AR_VERSION="~> 4.1.9" HIKARI_VERSION="2.3.12"
|
35
34
|
jdk: oraclejdk7
|
36
|
-
- rvm: jruby-1.7.
|
37
|
-
env: JRUBY_OPTS="$JRUBY_OPTS" AR_ADAPTER=postgresql AR_VERSION="~> 4.1.9" HIKARI_VERSION="2.3.
|
35
|
+
- rvm: jruby-1.7.22
|
36
|
+
env: JRUBY_OPTS="$JRUBY_OPTS" AR_ADAPTER=postgresql AR_VERSION="~> 4.1.9" HIKARI_VERSION="2.3.2-java6"
|
38
37
|
jdk: oraclejdk8
|
39
|
-
- rvm: jruby-1.7.
|
38
|
+
- rvm: jruby-1.7.22
|
40
39
|
env: JRUBY_OPTS="$JRUBY_OPTS" AR_ADAPTER=mysql AR_VERSION="~> 4.1.9" HIKARI_VERSION="2.0.1-java6"
|
41
40
|
jdk: oraclejdk8
|
42
|
-
- rvm: jruby-1.7.
|
41
|
+
- rvm: jruby-1.7.22
|
43
42
|
env: JRUBY_OPTS="--1.8 $JRUBY_OPTS" AR_ADAPTER=mysql AR_VERSION="~> 3.2.18" HIKARI_VERSION="2.2.5-java6"
|
43
|
+
jdk: oraclejdk8
|
44
|
+
include:
|
45
|
+
- rvm: jruby-9.0.1.0
|
46
|
+
env: JRUBY_OPTS="$JRUBY_OPTS" AR_ADAPTER=mysql AR_VERSION="~> 4.1.9" HIKARI_VERSION="2.2.5-java6"
|
47
|
+
jdk: oraclejdk7
|
48
|
+
- rvm: jruby-9.0.1.0
|
49
|
+
env: JRUBY_OPTS="$JRUBY_OPTS" AR_ADAPTER=mysql AR_VERSION="~> 3.2.18" HIKARI_VERSION="2.3.9"
|
44
50
|
jdk: oraclejdk8
|
data/Gemfile
CHANGED
@@ -19,6 +19,9 @@ end
|
|
19
19
|
if RUBY_VERSION.index('1.8') == 0
|
20
20
|
gem 'i18n', '< 0.7.0' # Gem::InstallError: i18n requires Ruby version >= 1.9.3
|
21
21
|
gem 'atomic', '1.1.16' # concurrent-ruby gem only for Ruby version >= 1.9.3
|
22
|
+
gem 'thread_safe', '~> 0.3'
|
23
|
+
else
|
24
|
+
gem 'concurrent-ruby', '1.0.0.pre4', :require => nil
|
22
25
|
end
|
23
26
|
|
24
27
|
platform :jruby do
|
data/Rakefile
CHANGED
@@ -29,6 +29,21 @@ task 'db:create:mysql' do
|
|
29
29
|
# puts "... run tests with MySQL using: `AR_ADAPTER=mysql rake test `"
|
30
30
|
end
|
31
31
|
|
32
|
+
task 'db:drop:mysql' do
|
33
|
+
fail "could not create database: mysql executable not found" unless mysql = _which('mysql')
|
34
|
+
ENV['Rake'] = true.to_s; ENV['AR_ADAPTER'] ||= 'mysql'
|
35
|
+
require File.expand_path('test/test_helper.rb', File.dirname(__FILE__))
|
36
|
+
|
37
|
+
script = "DROP DATABASE `#{AR_CONFIG[:database]}`;"
|
38
|
+
params = { '-u' => 'root' }
|
39
|
+
if ENV['DATABASE_YML']; require 'yaml'
|
40
|
+
password = YAML.load(File.new(ENV['DATABASE_YML']))["production"]["password"]
|
41
|
+
params['--password'] = password
|
42
|
+
end
|
43
|
+
puts "Creating MySQL database: #{AR_CONFIG[:database]}"
|
44
|
+
sh "cat #{_sql_script(script).path} | #{mysql} #{params.to_a.join(' ')}", :verbose => $VERBOSE
|
45
|
+
end
|
46
|
+
|
32
47
|
desc "Creates a (test) PostgreSQL database"
|
33
48
|
task 'db:create:postgresql' do
|
34
49
|
fail 'could not create database: psql executable not found' unless psql = _which('psql')
|
@@ -94,14 +109,14 @@ namespace :tomcat do
|
|
94
109
|
|
95
110
|
tomcat_maven_repo = 'http://repo2.maven.org/maven2/org/apache/tomcat'
|
96
111
|
download_dir = File.expand_path('test/jars', File.dirname(__FILE__))
|
97
|
-
version_default = '7.0.
|
112
|
+
version_default = '7.0.64'
|
98
113
|
|
99
114
|
[ 'tomcat-jdbc', 'tomcat-dbcp' ].each do |tomcat_pool|
|
100
115
|
namespace tomcat_pool.sub('tomcat-', '') do # rake tomcat:dbcp:download
|
101
116
|
|
102
117
|
tomcat_pool_jar = "#{tomcat_pool}.jar"
|
103
118
|
|
104
|
-
task :download, :version do |_,args| # rake tomcat:jdbc:download[7.0.
|
119
|
+
task :download, :version do |_,args| # rake tomcat:jdbc:download[7.0.64]
|
105
120
|
env_key = "#{tomcat_pool.upcase.sub('-', '_')}_VERSION" # 'TOMCAT_JDBC_VERSION'
|
106
121
|
version = args[:version] || ENV[env_key] || version_default
|
107
122
|
|
data/activerecord-bogacs.gemspec
CHANGED
@@ -8,19 +8,21 @@ Gem::Specification.new do |gem|
|
|
8
8
|
|
9
9
|
gem.authors = ['Karol Bucek']
|
10
10
|
gem.email = ['self@kares.org']
|
11
|
-
gem.description = %q{
|
12
|
-
gem.summary =
|
11
|
+
gem.description = %q{Improved ActiveRecord::ConnectionAdapters::ConnectionPool alternatives}
|
12
|
+
gem.summary = 'Bogacs contains several pool implementations that can be used as a replacement ' <<
|
13
|
+
"for ActiveRecord's built-in pool, e.g. DefaultPool is an upstream tuned version with an API " <<
|
14
|
+
'that is compatible with older AR versions.' <<
|
15
|
+
"\n\nNOTE: you'll need concurrent-ruby or thread_safe gem."
|
13
16
|
gem.homepage = "http://github.com/kares/activerecord-bogacs"
|
14
|
-
|
17
|
+
gem.licenses = ['MIT']
|
15
18
|
|
16
19
|
gem.files = `git ls-files`.split($/)
|
17
20
|
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
21
|
gem.test_files = gem.files.grep(%r{^test/})
|
19
22
|
gem.require_paths = ["lib"]
|
20
23
|
|
21
|
-
gem.
|
24
|
+
gem.add_development_dependency 'concurrent-ruby', '>= 0.9' if RUBY_VERSION.index('1.8') != 0
|
22
25
|
|
23
|
-
gem.add_development_dependency 'concurrent-ruby', '>= 0.8' if RUBY_VERSION.index('1.8') != 0
|
24
26
|
gem.add_development_dependency 'rake', '~> 10.3'
|
25
27
|
gem.add_development_dependency 'test-unit', '~> 2.5'
|
26
28
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'thread'
|
2
|
-
require 'thread_safe'
|
3
2
|
require 'monitor'
|
4
3
|
|
5
4
|
require 'active_record/connection_adapters/adapter_compat'
|
6
5
|
require 'active_record/bogacs/pool_support'
|
6
|
+
require 'active_record/bogacs/thread_safe'
|
7
7
|
|
8
8
|
module ActiveRecord
|
9
9
|
module Bogacs
|
@@ -234,7 +234,7 @@ module ActiveRecord
|
|
234
234
|
end
|
235
235
|
|
236
236
|
# The cache of reserved connections mapped to threads
|
237
|
-
@reserved_connections = ThreadSafe::
|
237
|
+
@reserved_connections = ThreadSafe::Map.new(:initial_capacity => @size)
|
238
238
|
|
239
239
|
@connections = []
|
240
240
|
@automatic_reconnect = true
|
@@ -279,7 +279,7 @@ module ActiveRecord
|
|
279
279
|
def release_connection(with_id = current_connection_id)
|
280
280
|
#synchronize do
|
281
281
|
conn = @reserved_connections.delete(with_id)
|
282
|
-
checkin conn if conn
|
282
|
+
checkin conn, true if conn
|
283
283
|
#end
|
284
284
|
end
|
285
285
|
|
@@ -381,15 +381,13 @@ module ActiveRecord
|
|
381
381
|
#
|
382
382
|
# +conn+: an AbstractAdapter object, which was obtained by earlier by
|
383
383
|
# calling +checkout+ on this pool.
|
384
|
-
def checkin(conn)
|
384
|
+
def checkin(conn, released = nil)
|
385
385
|
synchronize do
|
386
|
-
owner = conn.owner
|
387
|
-
|
388
386
|
conn.run_callbacks :checkin do
|
389
387
|
conn.expire
|
390
388
|
end
|
391
389
|
|
392
|
-
release owner
|
390
|
+
release conn.owner unless released
|
393
391
|
|
394
392
|
@available.add conn
|
395
393
|
end
|
@@ -453,7 +451,6 @@ module ActiveRecord
|
|
453
451
|
|
454
452
|
def release(owner)
|
455
453
|
thread_id = owner.object_id
|
456
|
-
|
457
454
|
@reserved_connections.delete thread_id
|
458
455
|
end
|
459
456
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require 'thread_safe'
|
2
1
|
require 'active_record/bogacs/pool_support'
|
2
|
+
require 'active_record/bogacs/thread_safe'
|
3
3
|
|
4
4
|
module ActiveRecord
|
5
5
|
module Bogacs
|
@@ -7,8 +7,7 @@ module ActiveRecord
|
|
7
7
|
|
8
8
|
include PoolSupport
|
9
9
|
|
10
|
-
include ThreadSafe::
|
11
|
-
alias_method :synchronize, :cheap_synchronize
|
10
|
+
include ThreadSafe::Synchronized
|
12
11
|
|
13
12
|
attr_accessor :automatic_reconnect
|
14
13
|
|
@@ -21,7 +20,7 @@ module ActiveRecord
|
|
21
20
|
@size = nil
|
22
21
|
#@automatic_reconnect = true
|
23
22
|
|
24
|
-
@reserved_connections = ThreadSafe::
|
23
|
+
@reserved_connections = ThreadSafe::Map.new #:initial_capacity => @size
|
25
24
|
end
|
26
25
|
|
27
26
|
# @private replacement for attr_reader :connections
|
@@ -4,9 +4,9 @@ module ActiveRecord
|
|
4
4
|
module Bogacs
|
5
5
|
module PoolSupport
|
6
6
|
|
7
|
-
def self.included(base)
|
8
|
-
#base.send :include, ThreadSafe::
|
9
|
-
end
|
7
|
+
#def self.included(base)
|
8
|
+
#base.send :include, ThreadSafe::Synchronized
|
9
|
+
#end
|
10
10
|
|
11
11
|
def new_connection
|
12
12
|
Base.send(spec.adapter_method, spec.config)
|
@@ -1,17 +1,8 @@
|
|
1
1
|
require 'active_record/connection_adapters/abstract/connection_pool'
|
2
2
|
|
3
3
|
require 'thread'
|
4
|
-
|
5
|
-
|
6
|
-
require 'concurrent/atomic'
|
7
|
-
rescue LoadError => e
|
8
|
-
begin
|
9
|
-
require 'atomic'
|
10
|
-
rescue LoadError
|
11
|
-
warn "shareable pool needs gem 'concurrent-ruby' please install or add it to your Gemfile"
|
12
|
-
raise e
|
13
|
-
end
|
14
|
-
end
|
4
|
+
|
5
|
+
require 'active_record/bogacs/thread_safe'
|
15
6
|
|
16
7
|
require 'active_record/bogacs/pool_support'
|
17
8
|
|
@@ -23,9 +14,17 @@ require 'active_record/bogacs/pool_support'
|
|
23
14
|
module ActiveRecord
|
24
15
|
module Bogacs
|
25
16
|
class ShareablePool < ConnectionAdapters::ConnectionPool # NOTE: maybe do not override?!
|
26
|
-
include ThreadSafe::Util::CheapLockable
|
27
17
|
include PoolSupport
|
28
18
|
|
19
|
+
if ActiveRecord::Bogacs::ThreadSafe.load_cheap_lockable(false)
|
20
|
+
include ThreadSafe::CheapLockable
|
21
|
+
else
|
22
|
+
alias_method :cheap_synchronize, :synchronize
|
23
|
+
end
|
24
|
+
|
25
|
+
ActiveRecord::Bogacs::ThreadSafe.load_atomic_reference
|
26
|
+
AtomicReference = ThreadSafe::AtomicReference
|
27
|
+
|
29
28
|
DEFAULT_SHARED_POOL = 0.25 # only allow 25% of the pool size to be shared
|
30
29
|
MAX_THREAD_SHARING = 5 # not really a strict limit but should hold
|
31
30
|
|
@@ -39,7 +38,7 @@ module ActiveRecord
|
|
39
38
|
# size 0.0 - 1.0 assumes percentage of the pool size
|
40
39
|
shared_size = ( @size * shared_size ).round if shared_size <= 1.0
|
41
40
|
@shared_size = shared_size.to_i
|
42
|
-
@shared_connections = ThreadSafe::
|
41
|
+
@shared_connections = ThreadSafe::Map.new # :initial_capacity => @shared_size, :concurrency_level => 20
|
43
42
|
end
|
44
43
|
|
45
44
|
# @override
|
@@ -232,14 +231,8 @@ module ActiveRecord
|
|
232
231
|
least_shared # might be nil in that case we'll likely wait (as super)
|
233
232
|
end
|
234
233
|
|
235
|
-
if defined? Concurrent::Atomic
|
236
|
-
Atomic = Concurrent::Atomic
|
237
|
-
else
|
238
|
-
Atomic = ::Atomic
|
239
|
-
end
|
240
|
-
|
241
234
|
def add_shared_connection(connection)
|
242
|
-
@shared_connections[connection] =
|
235
|
+
@shared_connections[connection] = AtomicReference.new(1)
|
243
236
|
end
|
244
237
|
|
245
238
|
def rem_shared_connection(connection)
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module Bogacs
|
3
|
+
module ThreadSafe
|
4
|
+
|
5
|
+
#def self.load_map
|
6
|
+
begin
|
7
|
+
require 'concurrent/map.rb'
|
8
|
+
rescue LoadError => e
|
9
|
+
begin
|
10
|
+
require 'thread_safe'
|
11
|
+
rescue
|
12
|
+
warn "activerecord-bogacs needs gem 'concurrent-ruby', '~> 1.0' (or the old 'thread_safe' gem) " <<
|
13
|
+
"please install or add it to your Gemfile"
|
14
|
+
raise e
|
15
|
+
end
|
16
|
+
end
|
17
|
+
#end
|
18
|
+
|
19
|
+
#load_map # always pre-load thread_safe
|
20
|
+
|
21
|
+
if defined? ::Concurrent::Map
|
22
|
+
Map = ::Concurrent::Map
|
23
|
+
else
|
24
|
+
Map = ::ThreadSafe::Cache
|
25
|
+
end
|
26
|
+
|
27
|
+
autoload :Synchronized, 'active_record/bogacs/thread_safe/synchronized'
|
28
|
+
|
29
|
+
def self.load_atomic_reference
|
30
|
+
return const_get :AtomicReference if const_defined? :AtomicReference
|
31
|
+
|
32
|
+
begin
|
33
|
+
require 'concurrent/atomic/atomic_reference.rb'
|
34
|
+
rescue LoadError => e
|
35
|
+
begin
|
36
|
+
require 'atomic'
|
37
|
+
rescue LoadError
|
38
|
+
warn "shareable pool needs gem 'concurrent-ruby', '>= 0.9.1' (or the old 'atomic' gem) " <<
|
39
|
+
"please install or add it to your Gemfile"
|
40
|
+
raise e
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
if defined? ::Concurrent::AtomicReference
|
45
|
+
const_set :AtomicReference, ::Concurrent::AtomicReference
|
46
|
+
else
|
47
|
+
const_set :AtomicReference, ::Atomic
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.load_cheap_lockable(required = true)
|
52
|
+
return const_get :CheapLockable if const_defined? :CheapLockable
|
53
|
+
|
54
|
+
begin
|
55
|
+
require 'concurrent/thread_safe/util/cheap_lockable.rb'
|
56
|
+
rescue LoadError => e
|
57
|
+
begin
|
58
|
+
require 'thread_safe'
|
59
|
+
rescue
|
60
|
+
return nil unless required
|
61
|
+
warn "activerecord-bogacs needs gem 'concurrent-ruby', '~> 1.0' (or the old 'thread_safe' gem) " <<
|
62
|
+
"please install or add it to your Gemfile"
|
63
|
+
raise e
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
if defined? ::Concurrent::ThreadSafe::Util::CheapLockable
|
68
|
+
const_set :CheapLockable, ::Concurrent::ThreadSafe::Util::CheapLockable
|
69
|
+
else
|
70
|
+
const_set :CheapLockable, ::ThreadSafe::Util::CheapLockable
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# @note Inpspired by thread_safe gem's Util::CheapLockable mixin.
|
2
|
+
module ActiveRecord::Bogacs
|
3
|
+
module ThreadSafe
|
4
|
+
engine = defined?(RUBY_ENGINE) && RUBY_ENGINE
|
5
|
+
if engine == 'rbx'
|
6
|
+
module Synchronized
|
7
|
+
# Making use of the Rubinius' ability to lock via object headers to avoid
|
8
|
+
# the overhead of the extra Mutex objects.
|
9
|
+
def synchronize
|
10
|
+
::Rubinius.lock(self)
|
11
|
+
begin
|
12
|
+
yield
|
13
|
+
ensure
|
14
|
+
::Rubinius.unlock(self)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
elsif engine == 'jruby'
|
19
|
+
module Synchronized
|
20
|
+
require 'jruby'
|
21
|
+
# Use Java's native synchronized (this) { wait(); notifyAll(); } to avoid
|
22
|
+
# the overhead of the extra Mutex objects
|
23
|
+
def synchronize
|
24
|
+
::JRuby.reference0(self).synchronized { yield }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
else
|
28
|
+
require 'thread'; require 'monitor'
|
29
|
+
# on MRI fallback to built-in MonitorMixin
|
30
|
+
Synchronized = MonitorMixin
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -42,7 +42,7 @@ if url = ENV['AR_URL'] || ENV['JDBC_URL']
|
|
42
42
|
config[:'url'] = url
|
43
43
|
else
|
44
44
|
config[:'host'] = ENV['AR_HOST'] || 'localhost'
|
45
|
-
config[:'database'] = ENV['AR_DATABASE'] || '
|
45
|
+
config[:'database'] = ENV['AR_DATABASE'] || 'ar_bogacs'
|
46
46
|
end
|
47
47
|
|
48
48
|
config[:'pool'] = ENV['AR_POOL_SIZE'] ? ENV['AR_POOL_SIZE'].to_i : pool_size
|
@@ -111,8 +111,8 @@ module ActiveRecord
|
|
111
111
|
module Bogacs
|
112
112
|
|
113
113
|
begin
|
114
|
-
require 'concurrent/atomic'
|
115
|
-
Atomic = Concurrent::
|
114
|
+
require 'concurrent/atomic/atomic_reference'
|
115
|
+
Atomic = Concurrent::AtomicReference
|
116
116
|
rescue LoadError
|
117
117
|
require 'atomic'
|
118
118
|
Atomic = ::Atomic
|
metadata
CHANGED
@@ -1,41 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-bogacs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karol Bucek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: thread_safe
|
15
|
-
version_requirements: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ~>
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0.3'
|
20
|
-
requirement: !ruby/object:Gem::Requirement
|
21
|
-
requirements:
|
22
|
-
- - ~>
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: '0.3'
|
25
|
-
prerelease: false
|
26
|
-
type: :runtime
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: concurrent-ruby
|
29
15
|
version_requirements: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - '>='
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
19
|
+
version: '0.9'
|
34
20
|
requirement: !ruby/object:Gem::Requirement
|
35
21
|
requirements:
|
36
22
|
- - '>='
|
37
23
|
- !ruby/object:Gem::Version
|
38
|
-
version: '0.
|
24
|
+
version: '0.9'
|
39
25
|
prerelease: false
|
40
26
|
type: :development
|
41
27
|
- !ruby/object:Gem::Dependency
|
@@ -66,7 +52,7 @@ dependencies:
|
|
66
52
|
version: '2.5'
|
67
53
|
prerelease: false
|
68
54
|
type: :development
|
69
|
-
description:
|
55
|
+
description: Improved ActiveRecord::ConnectionAdapters::ConnectionPool alternatives
|
70
56
|
email:
|
71
57
|
- self@kares.org
|
72
58
|
executables: []
|
@@ -85,6 +71,8 @@ files:
|
|
85
71
|
- lib/active_record/bogacs/false_pool.rb
|
86
72
|
- lib/active_record/bogacs/pool_support.rb
|
87
73
|
- lib/active_record/bogacs/shareable_pool.rb
|
74
|
+
- lib/active_record/bogacs/thread_safe.rb
|
75
|
+
- lib/active_record/bogacs/thread_safe/synchronized.rb
|
88
76
|
- lib/active_record/bogacs/version.rb
|
89
77
|
- lib/active_record/connection_adapters/adapter_compat.rb
|
90
78
|
- lib/active_record/shared_connection.rb
|
@@ -97,7 +85,8 @@ files:
|
|
97
85
|
- test/active_record/connection_pool_test_methods.rb
|
98
86
|
- test/test_helper.rb
|
99
87
|
homepage: http://github.com/kares/activerecord-bogacs
|
100
|
-
licenses:
|
88
|
+
licenses:
|
89
|
+
- MIT
|
101
90
|
metadata: {}
|
102
91
|
post_install_message:
|
103
92
|
rdoc_options: []
|
@@ -115,10 +104,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
104
|
version: '0'
|
116
105
|
requirements: []
|
117
106
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.4.
|
107
|
+
rubygems_version: 2.4.8
|
119
108
|
signing_key:
|
120
109
|
specification_version: 4
|
121
|
-
summary:
|
110
|
+
summary: 'Bogacs contains several pool implementations that can be used as a replacement
|
111
|
+
for ActiveRecord''s built-in pool, e.g. DefaultPool is an upstream tuned version
|
112
|
+
with an API that is compatible with older AR versions. NOTE: you''ll need concurrent-ruby
|
113
|
+
or thread_safe gem.'
|
122
114
|
test_files:
|
123
115
|
- test/active_record/bogacs/default_pool_test.rb
|
124
116
|
- test/active_record/bogacs/false_pool_test.rb
|