-1

I use rescue gem for managing my background jobs,

I want get the handle id after creating an new background job,

Then I can kill the background job anytime with the handle id.

But I couldn’t get it with resque, it seems there is no way to delete any queued job or running job,

I know that sidekiq has the way to deleted queued jobs

how to delete a job in sidekiq

Community
  • 1
  • 1
newBike
  • 14,385
  • 29
  • 109
  • 192

1 Answers1

0

You can use ResqueStatus gem to keep track of the job and delete it using id, if needed.

Following is an example given in the gem Docs:

Your job class:

class SleepJob
  include Resque::Plugins::Status

  def perform
    # your code
    ...
    ...
  end
end

Enqueue the job and get job id:

job_id = SleepJob.create(args)

Kill the job using job id:

Resque::Plugins::Status::Hash.kill(job_id)

Read More on Github

RAJ
  • 9,697
  • 1
  • 33
  • 63