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 1 module ActiveRecord::ConnectionAdapters
2   - class MysqlAdapter
  2 + class Mysql2Adapter
3 3 alias_method :execute_without_retry, :execute
4 4  
5 5 def execute(*args)
6 6 execute_without_retry(*args)
7   - rescue ActiveRecord::StatementInvalid => e
  7 + rescue Mysql2::Error => e
8 8 if e.message =~ /server has gone away/i
9 9 warn "Server timed out, retrying"
10 10 reconnect!
... ... @@ -14,4 +14,4 @@ module ActiveRecord::ConnectionAdapters
14 14 end
15 15 end
16 16 end
17 17 -end
  18 +end
18 19 \ No newline at end of file
... ...