Changed for mysql2 adapter
This commit is contained in:
parent
3b4e7b315b
commit
2519ecf686
|
@ -1,10 +1,10 @@
|
||||||
module ActiveRecord::ConnectionAdapters
|
module ActiveRecord::ConnectionAdapters
|
||||||
class MysqlAdapter
|
class Mysql2Adapter
|
||||||
alias_method :execute_without_retry, :execute
|
alias_method :execute_without_retry, :execute
|
||||||
|
|
||||||
def execute(*args)
|
def execute(*args)
|
||||||
execute_without_retry(*args)
|
execute_without_retry(*args)
|
||||||
rescue ActiveRecord::StatementInvalid => e
|
rescue Mysql2::Error => e
|
||||||
if e.message =~ /server has gone away/i
|
if e.message =~ /server has gone away/i
|
||||||
warn "Server timed out, retrying"
|
warn "Server timed out, retrying"
|
||||||
reconnect!
|
reconnect!
|
||||||
|
|
Loading…
Reference in a new issue