Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arzumy/558576 to your computer and use it in GitHub Desktop.
Save arzumy/558576 to your computer and use it in GitHub Desktop.
# Cheapskate solution so that delayed_job only kicks off in production
# Useful when you can't pass the development delayed_job in heroku cost to client
Delayed::DelayProxy.class_eval do
def method_missing(method, *args)
performable = Delayed::PerformableMethod.new(@target, method.to_sym, args)
if RAILS_ENV == "production"
Delayed::Job.create({
:payload_object => performable,
:priority => ::Delayed::Worker.default_priority
}.merge(@options))
else
performable.perform
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment