mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-13 22:59:19 +10:00
Only load MySQL2Adapter connection fix is MySQL2 is available.
Useful for Sqlite or Postgres installations.
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
module ActiveRecord::ConnectionAdapters
|
||||
class Mysql2Adapter
|
||||
alias_method :execute_without_retry, :execute
|
||||
if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
|
||||
module ActiveRecord::ConnectionAdapters
|
||||
class Mysql2Adapter
|
||||
alias_method :execute_without_retry, :execute
|
||||
|
||||
def execute(*args)
|
||||
execute_without_retry(*args)
|
||||
rescue Mysql2::Error => e
|
||||
if e.message =~ /server has gone away/i
|
||||
warn "Server timed out, retrying"
|
||||
reconnect!
|
||||
retry
|
||||
else
|
||||
raise e
|
||||
def execute(*args)
|
||||
execute_without_retry(*args)
|
||||
rescue Mysql2::Error => e
|
||||
if e.message =~ /server has gone away/i
|
||||
warn "Server timed out, retrying"
|
||||
reconnect!
|
||||
retry
|
||||
else
|
||||
raise e
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user