Commit 2519ecf686a8821e75a9a5bc271615be04e89059

Authored by Yvan
1 parent 3b4e7b31

Changed for mysql2 adapter

Showing 1 changed file with 3 additions and 3 deletions   Show diff stats
config/initializers/connection_fix.rb
1 module ActiveRecord::ConnectionAdapters 1 module ActiveRecord::ConnectionAdapters
2 - class MysqlAdapter 2 + class Mysql2Adapter
3 alias_method :execute_without_retry, :execute 3 alias_method :execute_without_retry, :execute
4 4
5 def execute(*args) 5 def execute(*args)
6 execute_without_retry(*args) 6 execute_without_retry(*args)
7 - rescue ActiveRecord::StatementInvalid => e 7 + rescue Mysql2::Error => e
8 if e.message =~ /server has gone away/i 8 if e.message =~ /server has gone away/i
9 warn "Server timed out, retrying" 9 warn "Server timed out, retrying"
10 reconnect! 10 reconnect!
@@ -14,4 +14,4 @@ module ActiveRecord::ConnectionAdapters @@ -14,4 +14,4 @@ module ActiveRecord::ConnectionAdapters
14 end 14 end
15 end 15 end
16 end 16 end
17 -end 17 -end
  18 +end
18 \ No newline at end of file 19 \ No newline at end of file