Tutorial :fetch start and end time for every job with delayed_job


Is there any way i can fetch start and time for my every job. I am using delayed_job.


Depending on your setup, you could include actions to record the start time and end time of your job within the job itself.

class SomeJob < Struct.new(:param1, :param2)    def perform      start_time = Time.now        ## Do Something        SomeModel.find(id).update_parameters({:start_time => start_time, :end_time => Time.now})    end  end  

Might be easier than forking the repository and I am not crazy about the idea of keeping all of those jobs around, it would slow down the queue over time depending on load.


delayed_job has no ability to track the start time, duration or end time of a job. It also by default removes the table entry upon success.

You would have to fork the github version to and create a patch to track and record this information or utilise an external method ( http://helderribeiro.net/?p=87 uses monit ) to track this data (again which uses a forked version).

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »