I have a Rails application with a Postgres database under AWS RDS with multi-az architecture. The HA architecture used by RDS is master / slave, and they provide a single endpoint service that points to the current master.
Whenever a switch to another database resource occurs, Active Record will continue to try to connect to the same server, instead of repeating the connection to obtain a new IP address for the wizard.
Is there a way to create a "global" salvation for an ActiveRecord::StatementInvalid: PG::ConnectionBad: PQsocket() can't get socket descriptor that just runs ActiveRecord::Base.connection_pool.disconnect! Which will make the following request work?
ruby-on-rails activerecord postgresql amazon-web-services amazon-rds
hernandes
source share