If you are using a Phusion Passenger and PassengerSpawnMethod smartphone.
# config/initializers/phusion_passenger.rb if defined?(PhusionPassenger) PhusionPassenger.on_event(:starting_worker_process) do |forked| if forked # the following is *required* for Rails + "PassengerSpawnMethod smart". if defined?(ActiveRecord::Base) # force reconnect to "master" connection. ActiveRecord::Base.connection_pool.disconnect! # force reconnect to our octopus "slave" pools. This may include the "master" pool above. if defined?(Octopus) ActiveRecord::Base.connection_proxy.instance_variable_get(:@shards).each { |name, pool| pool.disconnect! } end end end end end
This is using
# database.yml and shards.yml reconnect: true
source share