Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

if disconnect fails, still try to reconnect to db

  • Loading branch information...
commit 9e7defdb9ec0f8e24d047d1f2b0b0bc9e774e556 1 parent fbb11b7
Tom Pesman authored

Showing 1 changed file with 7 additions and 2 deletions. Show diff stats Hide diff stats

  1. +7 2 lib/push/daemon/database_reconnectable.rb
9 lib/push/daemon/database_reconnectable.rb
@@ -40,8 +40,13 @@ def database_connection_lost(name)
40 40 end
41 41
42 42 def reconnect_database
43   - ActiveRecord::Base.clear_all_connections!
44   - ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[ENV['RAILS_ENV']])
  43 + begin
  44 + ActiveRecord::Base.clear_all_connections!
  45 + rescue
  46 + Push::Daemon.logger.error("ActiveRecord::Base.clear_all_connections! failed")
  47 + ensure
  48 + ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[ENV['RAILS_ENV']])
  49 + end
45 50 end
46 51
47 52 def check_database_is_connected

0 comments on commit 9e7defd

Please sign in to comment.
Something went wrong with that request. Please try again.