Handle db connection and disconnection during forking of resque jobs on Heroku cedar stack.
Fixes the following postgres log errors…
PGError: server closed the connection unexpectedly
And
LOG: could not receive data from client: Connection reset by peer LOG: unexpected EOF on client connection
This is not an official Heroku gem.
Install the gem in your Gemfile
gem 'resque-heroku'
Include Resque::Heroku in your job classes
require 'resque/plugins/heroku' class Job extend Resque::Plugins::Heroku def self.perform # do stuff end end
Load resque-heroku tasks from your Rakefile
require 'resque/plugins/heroku/tasks'
Now rake jobs:work is available.