diff --git a/config/initializers/connection_fix.rb b/config/initializers/connection_fix.rb index e77253afc4e7113b63291bb7a9dfbc1c4a6326ea..d15b0c206cfc4afb3db3bce868fa29eb990e3d0e 100644 --- a/config/initializers/connection_fix.rb +++ b/config/initializers/connection_fix.rb @@ -1,10 +1,10 @@ module ActiveRecord::ConnectionAdapters - class MysqlAdapter + class Mysql2Adapter alias_method :execute_without_retry, :execute def execute(*args) execute_without_retry(*args) - rescue ActiveRecord::StatementInvalid => e + rescue Mysql2::Error => e if e.message =~ /server has gone away/i warn "Server timed out, retrying" reconnect! @@ -14,4 +14,4 @@ module ActiveRecord::ConnectionAdapters end end end -end +end \ No newline at end of file