dbbrowser 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,12 +11,27 @@ class ConnectionMan # connection manager
11
11
 
12
12
  def connection_for( key )
13
13
  # cache connections - needed? why? why not??
14
- con = CONNECTS[ key ] ||= AbstractModel.connection_for( key )
14
+
15
+ # hack: for now only use cached connection if still active
16
+ # if not; get a new one to avoid connection closed errors in rails
17
+ con = CONNECTS[ key ]
18
+ if con
19
+ puts "[ConnectionMan] cached connection found; con.active? #{con.active?}"
20
+ unless con.active?
21
+ puts "[ConnectionMan] *** reset cached connection (reason: connection stale/closed/not active)"
22
+ con = CONNECTS[ key ] = nil
23
+ end
24
+ end
25
+
26
+ if con.nil?
27
+ con = CONNECTS[ key ] = AbstractModel.connection_for( key )
28
+ end
15
29
 
16
30
  # note: make sure connection is active?
17
31
  # use verify! - will try active? followed by reconnect!
18
32
  # - todo: check ourselves if active? - why? why not??
19
- con.verify!
33
+ # -- not working w/ rails - after verify! still getting error w/ closed connection
34
+ # -- con.verify!
20
35
 
21
36
  # wrap ActiveRecord connection in our own connection class
22
37
  Connection.new( con, key )
@@ -1,4 +1,4 @@
1
1
 
2
2
  module DbBrowser
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbbrowser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-10-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: logutils
16
- requirement: &73238970 !ruby/object:Gem::Requirement
16
+ requirement: &82554070 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.5'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *73238970
24
+ version_requirements: *82554070
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdoc
27
- requirement: &73238710 !ruby/object:Gem::Requirement
27
+ requirement: &82553810 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.10'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *73238710
35
+ version_requirements: *82553810
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: hoe
38
- requirement: &73238390 !ruby/object:Gem::Requirement
38
+ requirement: &82553530 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '3.3'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *73238390
46
+ version_requirements: *82553530
47
47
  description: dbbrowser - database browser (connections, schema, tables, records, etc.)
48
48
  as mountable web app
49
49
  email: webslideshow@googlegroups.com