mercoledì 2 luglio 2014

How to delete a scheduled rails delayed_job

In one of my "experiment" I am using collectiveidea/delayed_job gem to execute background and delayed tasks/jobs.

Now the question is: how to delete a job  which has already been scheduled/queued?

As simple as that:



#schedule a delayed method call
dj = reminder.delay(run_at: 5.minutes.from_now).send #this is your delayed method object

#delete a scheduled delayed job
djid = dj.id #this is the assigned delayed_job id

Delayed::Job.delete(djid)

Nessun commento:

Posta un commento