Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Destroying all delayed job in rails

I am using collectiveidea for rails 2.3.8. I am creating array of delayed jobs to perform some tasks, after some time I want to destroy all the delayed jobs which are running. If anyone know the way to do this please help me.

like image 726
Rahul Tapali Avatar asked Mar 13 '12 11:03

Rahul Tapali


People also ask

How do I stop a delayed job in Rails?

Using delayed_job 4.0. 2, when -m is passed to 'delayed_job -m start', both delayed_job. pid and delayed_job_monitor. pid are written to tmp/pids, and 'delayed_job stop' kills both processes.

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.

How do I create a delayed job in Rails?

script/delayed_job can be used to manage a background process which will start working off jobs. To do so, add gem "daemons" to your Gemfile and make sure you've run rails generate delayed_job . Workers can be running on any computer, as long as they have access to the database and their clock is in sync.


1 Answers

You can invoke rake jobs:clear to delete all jobs in the queue.

like image 71
Lee Jarvis Avatar answered Sep 24 '22 08:09

Lee Jarvis