Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails + Delayed Job: Where is the correct place to store custom job classes?

Tags:

I'm new to delayed_job and i'm starting to write my own "custom jobs". Each custom job is basically just a regular ruby class but i'm not sure where these custom job classes are normally stored within the project's directory structure.

I'm thinking lib, but lib seems to be a junk drawer at this point :/ (maybe that's ok though)

Thanks!!

like image 478
Mario Zigliotto Avatar asked Jun 03 '12 20:06

Mario Zigliotto


People also ask

What is delayed job in Rails?

Delayed Job, also known as DJ, makes it easy to add background tasks to your Rails applications on Heroku. You can also use Resque and many other popular background queueing libraries. Delayed Job uses your database as a queue to process background jobs.

How do I know if my job is running late?

The most simple way to check whether delayed_job is running or not, is to check at locked_by field. This field will contain the worker or process locking/processing the job. Running Delayed::Job. where('locked_by is not null') will give you some results, if there are jobs running.


1 Answers

The common way for that is to create jobs folder under app folder. But the only thing you should care about is that they are your files, so do it in a way you find most comfortable for yourself.

like image 165
Yuri Barbashov Avatar answered Sep 18 '22 06:09

Yuri Barbashov