ismail
ismail

Reputation: 3923

Delayed job not sending mails - How to debug?

I have delayed job setup with the following settings:

Delayed::Worker.max_attempts = 3
Delayed::Worker.delay_jobs = !Rails.env.test?
Delayed::Worker.destroy_failed_jobs = false
Delayed::Worker.sleep_delay = 120

I have started a worker, working in development and have configured ActionMailer to send mail.

Also I call it with the following in my controller:

OrderMailer.delay.order_notification(@order)

I can see the jobs created in Mongo, they dont show any errors in the console, how do I find out if there were any errors?? Is there some kind of job log?

I get the following in console:

1 jobs processed at 3.6244 j/s, 0 failed ..

Upvotes: 1

Views: 1726

Answers (2)

Mayinx
Mayinx

Reputation: 374

Another great way to debug DelayedJob is the gem Delayed Job Web (see https://github.com/ejschmitt/delayed_job_web), which gives you a "Resque like web interface for delayed job", accessible via http://localhost:3000/delayed_job. The interface provides a "Failed Jobs"-Tab, where you can investigate the "last error"-Field more conveniently than in the terminal...

Upvotes: 1

jvnill
jvnill

Reputation: 29599

there should be a log/delayed_job.log which lists the jobs processed. You can also use the database to access the errors for failed tasks.

>> failed_jobs = Delayed::Job.where('attempts > 0')
>> failed_jobs.first.last_error

Upvotes: 2

Related Questions