Method: Rpush::Daemon::Store::ActiveRecord::Reconnectable#with_database_reconnect_and_retry

Defined in:
lib/rpush/daemon/store/active_record/reconnectable.rb

#with_database_reconnect_and_retryObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/rpush/daemon/store/active_record/reconnectable.rb', line 35

def with_database_reconnect_and_retry
  ::ActiveRecord::Base.connection_pool.with_connection do
    yield
  end
rescue *ADAPTER_ERRORS => e
  Rpush.logger.error(e)
  sleep_to_avoid_thrashing
  database_connection_lost
  retry
end