Skip to content

Instantly share code, notes, and snippets.

@mmaa
mmaa / gist:663602
Created November 5, 2010 03:22
envelope balance
envelope_balance =
EnvelopeTransaction.where(
:destination => [self]).sum(:amount) -
EnvelopeTransaction.where(
:source_type => envelope,
:source_id => [self]).sum(:amount)
% RAILS_ENV=production rake middleware
use ActionDispatch::Static
use Rack::Lock
use ActiveSupport::Cache::Strategy::LocalCache
use Rack::Runtime
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
use ActionDispatch::RemoteIp
use Rack::Sendfile
use ActionDispatch::Callbacks
module Resque
...
class Worker
...
def perform(job)
begin
run_hook :after_fork, job
job.perform
rescue Object => e
break if e.is_a?(Resque::DirtyExit) # This is the line I added.