I am processing a task that needs some time, so I am thinking about assigning this task to Delayed Job. Would be quite user-friendly to display to users an information about status of the currently processed task - like "processing" and "done".
Checking out the official Github page and I see there some success
, after
, etc methods, but how to use them?
Thank you in advance.
Actually I used DelayedJob effectively in my project. The following procedure works fine for me. Assume we have a module or class like Subscription and I call a method which was defined as an module method using delayed job as follows:
Subscription.delay(:queue => "insertion_order_#{advertiser.advertiser_id}",:priority => 1,:record_of => request_tracker.record_of).pull_data(advertiser,date,Insertionorder)
Now if you want to track error,success or any other hooks then you have to define them in the module or the respective class as follows
module Subsciption
def self.error(job, exception)
puts "Error occurred"
sleep(160)
end
end
Means all those hooks are working on the object which is used for background processing.