forked from OpenNeo/impress
resque will reconnect to database after each job to avoid Gone Away errors
This commit is contained in:
parent
f547a75c40
commit
3cd06c9f64
1 changed files with 6 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
# Sometimes the Resque workers have trouble maintaining their connections to
|
||||
# Redis and to the database. It's not entirely clear when and why (though the
|
||||
# internet suggests that it has to do with lying dormant for too long), but
|
||||
# this fix ensures that Redis and the database are available at the start of
|
||||
# every job.
|
||||
Resque.after_fork do
|
||||
Resque.redis.client.reconnect
|
||||
ActiveRecord::Base.connection_handler.verify_active_connections!
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue