Skip to content

Instantly share code, notes, and snippets.

@krasio
Created March 9, 2011 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krasio/862966 to your computer and use it in GitHub Desktop.
Save krasio/862966 to your computer and use it in GitHub Desktop.
module Resque
class Job
alias_method :original_perform, :perform
def perform
original_perform
rescue ActiveRecord::StatementInvalid => e
if e.message =~ /server has gone away/i
ActiveRecord::Base.verify_active_connections!
retry
else
raise e
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment