Run Resque on Heroku
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/resque/plugins
spec
.gitignore
Gemfile basic support for db connection handling and rake jobs:work Sep 12, 2011
LICENSE
Rakefile
readme.rdoc improve the clarify of the readme Feb 19, 2013
resque-heroku.gemspec

readme.rdoc

Overview

Automatically handle db connection and disconnection during forking of resque jobs on Heroku Cedar stack.

This plugin is for Rails only since it hooks into ActiveRecord callbacks.

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.

Usage

Install the gem in your Gemfile

gem 'resque-heroku'

Require the module in an initializer (config/initializers/resque.rb)

require 'resque/plugins/heroku'

Extend the worker classes

class Job
  extend Resque::Plugins::Heroku

  def self.perform
    # do stuff
  end
end

Require this file in your Rakefile

require 'resque/plugins/heroku/tasks'

Start the Resque worker in your Procfile using `rake jobs:work`

worker: bundle exec rake jobs:work