with_connection 0.1.24 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/active_record/round_robin.rb +18 -0
- data/lib/with_connection/connection_pool.rb +0 -11
- data/with_connection.gemspec +3 -2
- metadata +4 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module ConnectionAdapters
|
3
|
+
class ConnectionPool
|
4
|
+
# when checking in a connection put it at the end of the connections array.
|
5
|
+
# this way all the connections get used
|
6
|
+
def checkin(conn)
|
7
|
+
@connection_mutex.synchronize do
|
8
|
+
conn.send(:_run_checkin_callbacks) do
|
9
|
+
@connections.delete conn
|
10
|
+
@connections.push conn
|
11
|
+
@checked_out.delete conn
|
12
|
+
@queue.signal
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -30,17 +30,6 @@ module WithConnection
|
|
30
30
|
end
|
31
31
|
alias_method_chain :with_connection, :debug
|
32
32
|
|
33
|
-
def checkin(conn)
|
34
|
-
@connection_mutex.synchronize do
|
35
|
-
conn.send(:_run_checkin_callbacks) do
|
36
|
-
@connections.delete conn
|
37
|
-
@connections.push conn
|
38
|
-
@checked_out.delete conn
|
39
|
-
@queue.signal
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
33
|
def checkout_with_debug
|
45
34
|
if @debug_with_connection && ! @using_with_connection
|
46
35
|
Rails.logger.warn "#{name} not using with_connection, backtrace: #{caller.inspect}"
|
data/with_connection.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "with_connection"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Doug Youch"]
|
12
|
-
s.date = "2013-10-
|
12
|
+
s.date = "2013-10-29"
|
13
13
|
s.description = "Uses active record connection pool logic with the fiber_patch"
|
14
14
|
s.email = "doug@sessionm.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
"VERSION",
|
29
29
|
"lib/active_record/fiber_patches.rb",
|
30
30
|
"lib/active_record/fiber_patches/log_subscriber.rb",
|
31
|
+
"lib/active_record/round_robin.rb",
|
31
32
|
"lib/active_support/cache/features/adapter_methods.rb",
|
32
33
|
"lib/active_support/cache/memcache_connection_pool.rb",
|
33
34
|
"lib/dalli/async_socket.rb",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: with_connection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- VERSION
|
95
95
|
- lib/active_record/fiber_patches.rb
|
96
96
|
- lib/active_record/fiber_patches/log_subscriber.rb
|
97
|
+
- lib/active_record/round_robin.rb
|
97
98
|
- lib/active_support/cache/features/adapter_methods.rb
|
98
99
|
- lib/active_support/cache/memcache_connection_pool.rb
|
99
100
|
- lib/dalli/async_socket.rb
|
@@ -116,7 +117,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
117
|
version: '0'
|
117
118
|
segments:
|
118
119
|
- 0
|
119
|
-
hash:
|
120
|
+
hash: 4242180929008766198
|
120
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
122
|
none: false
|
122
123
|
requirements:
|