activejob-cancel provides cancel method to Active Job. Currently it supports only
resque and the Active Job
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install activejob-cancel
# app/jobs/hello_job.rb class HelloJob < ActiveJob::Base def perform end end
job = HelloJob.perform_later job.cancel
HelloJob.cancel(job id) # You must use the job id that Active Job provided.
If you want to use an id that backend job provided, use the
Bug reports and pull requests are welcome on GitHub at https://github.com/y-yagi/activejob-cancel. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.