Delay :: Task tasks are not executed and are not cleared from the queue when they are executed

My Delayed :: Jobs are queued but not working. When I check them on the console, last_errorthere are no errors in the field indicating that they were not running. I can run them all successfully in the console using some_job.invoke_job, but after starting them they are not cleared from the queue as they should (they were cleared after manually calling them in the console).

I am running delayed_job (4.0.4) and Rails 4.1.4. This issue seems to have occurred after the gem update.

I restarted the delayed_job server several times.

Here is the job in line:

#<Delayed::Backend::ActiveRecord::Job id: 725, priority: 0, attempts: 0, handler: "--- !ruby/object:Delayed::PerformableMethod\nobject...", last_error: nil, run_at: "2014-10-16 01:52:11", locked_at: nil, failed_at: nil, locked_by: nil, queue: nil, created_at: "2014-10-16 01:52:11", updated_at: "2014-10-16 01:52:11">

How can I start my delay :: jobs to start automatically and get out of the queue when they run out?

+4
source share
1 answer

First of all, make sure that you start the process responsible for processing pending tasks . You have two options here:

  1. bin/delayed_job - launches a daemon that listens for incoming requests.
  2. rake jobs:work - Handles tasks in the foreground.

You mentioned using it in the console - this method handles the work, but will not do anything else, so your work has not been removed from the queue. Delayed::Job#invoke_job

You can use to start tasks and subsequently remove successful ones from the queue . Delayed::Worker#run

For instance:

some_job = Delayed::Job.find(job_id)
Delayed::Worker.new.run(some_job) 
0
source

All Articles