fresh_connection 0.0.4 → 0.0.7
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.
data/fresh_connection.gemspec
CHANGED
data/lib/fresh_connection.rb
CHANGED
@@ -9,7 +9,11 @@ module FreshConnection
|
|
9
9
|
@app.call(env)
|
10
10
|
ensure
|
11
11
|
unless env.key?("rack.test")
|
12
|
-
|
12
|
+
if FreshConnection::SlaveConnection.master_clear_connection?
|
13
|
+
ActiveRecord::Base.clear_all_connections!
|
14
|
+
else
|
15
|
+
ActiveRecord::Base.clear_active_connections!
|
16
|
+
end
|
13
17
|
FreshConnection::SlaveConnection.clear_all_connections!
|
14
18
|
end
|
15
19
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module FreshConnection
|
2
2
|
class SlaveConnection
|
3
3
|
class << self
|
4
|
+
attr_writer :ignore_models, :ignore_configure_connection, :master_clear_connection
|
5
|
+
|
4
6
|
def connection
|
5
7
|
slave_connection
|
6
8
|
end
|
@@ -24,10 +26,6 @@ module FreshConnection
|
|
24
26
|
Thread.current[:fresh_connection_slave_access] ||= false
|
25
27
|
end
|
26
28
|
|
27
|
-
def ignore_models=(model_names)
|
28
|
-
@ignore_models = model_names
|
29
|
-
end
|
30
|
-
|
31
29
|
def ignore_model?(model_name)
|
32
30
|
(@ignore_models || []).include?(model_name)
|
33
31
|
end
|
@@ -36,8 +34,8 @@ module FreshConnection
|
|
36
34
|
!!@ignore_configure_connection
|
37
35
|
end
|
38
36
|
|
39
|
-
def
|
40
|
-
@
|
37
|
+
def master_clear_connection?
|
38
|
+
@master_clear_connection.nil? || @master_clear_connection
|
41
39
|
end
|
42
40
|
|
43
41
|
private
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fresh_connection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -53,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
53
|
version: '0'
|
54
54
|
requirements: []
|
55
55
|
rubyforge_project: fresh_connection
|
56
|
-
rubygems_version: 1.8.
|
56
|
+
rubygems_version: 1.8.23
|
57
57
|
signing_key:
|
58
58
|
specification_version: 3
|
59
59
|
summary: FreshConnection supports of connect with Mysql slave servers via Load Balancers.
|