how to delete a job in sidekiq

前端 未结 8 2000
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-07 20:32

I am using sidekiq in my rails app. Users of my app create reports that start a sidekiq job. However, sometimes users want to be able to cancel \"processing\" reports. Delet

8条回答
  •  温柔的废话
    2020-12-07 21:03

    The simplest way I found to do this is:

    job = Sidekiq::ScheduledSet.new.find_job([job_id])
    

    where [job_id] is the JID that pertains to the report. Followed by:

    job.delete
    

    I found no need to iterate through the entire queue as described by other answers here.

提交回复
热议问题