diff options
author | Sytse Sijbrandij <sytse@dosire.com> | 2013-08-10 16:20:33 +0200 |
---|---|---|
committer | Sytse Sijbrandij <sytse@dosire.com> | 2013-08-10 16:20:33 +0200 |
commit | 994fe9fd31f20ea9122fd8819d23f621cfae7989 (patch) | |
tree | e23627f076f8218af298e9d76ac02b0c4dc6cd51 /config | |
parent | fe059b6c4bfb4cb0f7c7dec8fb7cd3da7634df30 (diff) | |
download | gitlab-ce-994fe9fd31f20ea9122fd8819d23f621cfae7989.tar.gz |
Fix for Resque forking might cause stuck workers for the threaded Sidekiq.
Diffstat (limited to 'config')
-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 |