Commit 4b96907e7cc7cef55034499c2d5c5d0998637c99

Authored by Ariejan de Vroom
2 parents 3b4e7b31 2519ecf6

Merge pull request #603 from yvmarques/patch-1

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