activerecord-refresh_connection 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eff77f96de76b973066a0ee7f2358e4b210a0f8c
4
- data.tar.gz: b86cc9911aca2218ab48c876b692cf0c8ff932ee
3
+ metadata.gz: dcc81384ccdcb81089a22c49d4d5d253a1e7c0bd
4
+ data.tar.gz: 592f0dbcf3d4f5ac4923d9b8affbb6c6fccc7b2e
5
5
  SHA512:
6
- metadata.gz: f8e3187ce0bce10d3fb00c23678b2ad67dd5d7a143a980de202ab0894d26fbe1a44e3ccca942ce7c75a52d1e425376024469d4001c79c9221cc04787a3ec46d4
7
- data.tar.gz: 228884e5f013745bc3015e9ed28101adedd604c2121c47c1ff21894d942282e62f5d0bc0b4af055ea5665fa74c7889d57c8f6019c35e9fe52a3604114e9cfe6c
6
+ metadata.gz: 38d112fac291d9ced98c09e309ca431c62c02c53e18a867abdad1cf987a986ed5c183be47ec6ef7788e337c4724af89e0e0af9a313c6e334d8a7f13c703df4a7
7
+ data.tar.gz: dac849aeb38f752370c3334904dcf1b172b7e512d8da44dd124f7c8437391e451e329c2c48f7a4de8238f829803da30b5a0acafaa6c81f8723ce21c91ccd2f26
@@ -1,3 +1,9 @@
1
+ ## 0.0.4
2
+
3
+ Fixes:
4
+
5
+ * Call clear_active_connections! if not calling clear_all_connections!
6
+
1
7
  ## 0.0.3
2
8
 
3
9
  Fixes:
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "activerecord-refresh_connection"
7
- spec.version = "0.0.3"
7
+ spec.version = "0.0.4"
8
8
  spec.authors = ["Naotoshi Seo"]
9
9
  spec.email = ["sonots@gmail.com"]
10
10
  spec.summary = %q{Refresh ActiveRecord connection on each rack request}
@@ -16,22 +16,28 @@ module ActiveRecord
16
16
 
17
17
  response = @app.call(env)
18
18
 
19
- clear_connections = should_clear_connections? && !testing
20
-
21
19
  response[2] = ::Rack::BodyProxy.new(response[2]) do
22
20
  # disconnect all connections on the connection pool
23
- ActiveRecord::Base.clear_all_connections! if clear_connections
21
+ clear_connections unless testing
24
22
  end
25
23
 
26
24
  response
27
25
  rescue Exception
28
- ActiveRecord::Base.clear_all_connections! if clear_connections
26
+ clear_connections unless testing
29
27
  raise
30
28
  end
31
29
 
32
30
  private
33
31
 
34
- def should_clear_connections?
32
+ def clear_connections
33
+ if should_clear_all_connections?
34
+ ActiveRecord::Base.clear_all_connections!
35
+ else
36
+ ActiveRecord::Base.clear_active_connections!
37
+ end
38
+ end
39
+
40
+ def should_clear_all_connections?
35
41
  return true if max_requests <= 1
36
42
 
37
43
  @mutex.synchronize do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-refresh_connection
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-17 00:00:00.000000000 Z
11
+ date: 2014-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord