Skip to content

Instantly share code, notes, and snippets.

@choonkeat
Created March 4, 2011 01:07
Show Gist options
  • Save choonkeat/853958 to your computer and use it in GitHub Desktop.
Save choonkeat/853958 to your computer and use it in GitHub Desktop.
making delayed_job perform synchronously in development
# inside config/environment.rb
if Rails.env == 'development'
Rails.logger.info "Delayed::Job is executed synchronously in #{Rails.env} mode."
Delayed::Job.class_eval do
def self.enqueue(obj)
Rails.logger.info "Delayed::Job:SYNC START"
obj.perform
Rails.logger.info "Delayed::Job:SYNC END"
end
end
end
@potomak
Copy link

potomak commented Feb 6, 2012

To make it work with collectiveidea/delayed_job version 2.1.4 I changed line 7 with

obj[:payload_object].perform

@skojin
Copy link

skojin commented Jul 5, 2013

use Delayed::Worker.delay_jobs = false https://github.com/collectiveidea/delayed_job#gory-details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment