diff options
author | Sytse Sijbrandij <sytse@dosire.com> | 2013-08-10 16:20:33 +0200 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2013-09-25 14:35:51 +0200 |
commit | 38cf6281a7b1c0e5c0c943383b62b88f962b0a12 (patch) | |
tree | 9164a560beb57e3a57b3d2ee84bbe3012881e8e6 | |
parent | 9360c7334a90349c006be772f603a0977654c263 (diff) | |
download | gitlab-ce-38cf6281a7b1c0e5c0c943383b62b88f962b0a12.tar.gz |
Fix for Resque forking might cause stuck workers for the threaded Sidekiq.
-rw-r--r-- | config/initializers/connection_fix.rb | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/config/initializers/connection_fix.rb b/config/initializers/connection_fix.rb deleted file mode 100644 index 16cb69ca68b..00000000000 --- a/config/initializers/connection_fix.rb +++ /dev/null @@ -1,36 +0,0 @@ -# from http://gist.github.com/238999 -# -# If your workers are inactive for a long period of time, they'll lose -# their MySQL connection. -# -# This hack ensures we re-connect whenever a connection is -# lost. Because, really. why not? -# -# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar) -# -# From: -# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/ - -if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter) - - module ActiveRecord::ConnectionAdapters - - class Mysql2Adapter - 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 - -end |