Skip to content
Snippets Groups Projects
Commit 3b4e7b31 authored by Ariejan de Vroom's avatar Ariejan de Vroom
Browse files

Added fix for "MySQL has gone away" errors with Resque workers.

parent 1647f46b
No related branches found
No related tags found
No related merge requests found
module ActiveRecord::ConnectionAdapters
class MysqlAdapter
alias_method :execute_without_retry, :execute
def execute(*args)
execute_without_retry(*args)
rescue ActiveRecord::StatementInvalid => e
if e.message =~ /server has gone away/i
warn "Server timed out, retrying"
reconnect!
retry
else
raise e
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment