Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I keep a Delayed_Job task from failing with "execution expired"

I thought that since it was a background process, that there wouldn't be any sort of timeout. I used delayed_job to run reports in the background. Very large, long-running reports are failing with this message.

I'm running Rails 2.3.5 on Apache2 with Phusion Passenger.

like image 616
AKWF Avatar asked Feb 09 '11 15:02

AKWF


1 Answers

From the delayed_jobs faq wiki page on github:

# config/initializers/delayed_job_config.rb
Delayed::Job.destroy_failed_jobs = false
silence_warnings do
  Delayed::Job.const_set("MAX_ATTEMPTS", 3)
  Delayed::Job.const_set("MAX_RUN_TIME", 5.minutes)
end

You are looking to increase the MAX_RUN_TIME. The default is 4 hours, so you likely want to set it to something like 6.hours or longer. It should be the longest you think the job should take, but this is clearly application / job specific and you likely know what the longest time that's acceptable is.

like image 78
Brett Bender Avatar answered Nov 08 '22 18:11

Brett Bender