Rails 4.2 get delayed job id from active job

后端 未结 4 659
南笙
南笙 2021-01-02 00:47

Any idea how to get the Delayed::Job id from the ActiveJob enqueuing? When I enqueue a job I get back an instance of ActiveJob::Base with a @

4条回答
  •  南笙
    南笙 (楼主)
    2021-01-02 01:04

    Instead of removing the job from the queue if it is cancelled you could model a cancellation of the job itself.

    Then, when you come to run the GenerateReportJob you can first check for a cancellation of the report. If there is one then you can destroy the cancellation record and drop out of the report generation. If there is no cancellation then you can carry on as normal.

提交回复
热议问题