diff --git a/lib/active_record/connection_adapters/postgresql_fallback_adapter.rb b/lib/active_record/connection_adapters/postgresql_fallback_adapter.rb index 3d4f9b24a49..4c3ba60f9d3 100644 --- a/lib/active_record/connection_adapters/postgresql_fallback_adapter.rb +++ b/lib/active_record/connection_adapters/postgresql_fallback_adapter.rb @@ -18,8 +18,12 @@ class PostgreSQLFallbackHandler MessageBus.subscribe(DATABASE_DOWN_CHANNEL) do |payload, pid| if @initialized && pid != Process.pid - RailsMultisite::ConnectionManagement.with_connection(payload.data['db']) do - clear_connections + begin + RailsMultisite::ConnectionManagement.with_connection(payload.data['db']) do + clear_connections + end + rescue PG::UnableToSend + # Site has already failed over end end end