Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/y-yagi/activejob-cancel
https://github.com/y-yagi/activejob-cancel
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/y-yagi/activejob-cancel
- Owner: y-yagi
- License: mit
- Created: 2016-06-29T06:21:54.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-01-22T22:57:56.000Z (10 months ago)
- Last Synced: 2024-11-14T19:06:20.657Z (1 day ago)
- Language: Ruby
- Size: 75.2 KB
- Stars: 56
- Watchers: 4
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# ActiveJob::Cancel
`activejob-cancel` provides cancel method to Active Job. Currently it supports only `Sidekiq`, `Delayed Job`, `resque` and the Active Job `TestAdapter`.
![Build Status](https://github.com/y-yagi/activejob-cancel/workflows/CI/badge.svg)
[![Gem Version](https://badge.fury.io/rb/activejob-cancel.svg)](http://badge.fury.io/rb/activejob-cancel)
[![Code Climate](https://codeclimate.com/github/y-yagi/activejob-cancel/badges/gpa.svg)](https://codeclimate.com/github/y-yagi/activejob-cancel)
[![Coverage Status](https://coveralls.io/repos/github/y-yagi/activejob-cancel/badge.svg?branch=master)](https://coveralls.io/github/y-yagi/activejob-cancel?branch=master)## Installation
Add this line to your application's Gemfile:
```ruby
gem 'activejob-cancel'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install activejob-cancel
## Usage
```ruby
# app/jobs/hello_job.rb
class HelloJob < ActiveJob::Base
def perform
end
end
``````ruby
job = HelloJob.perform_later
job.cancel
```Or
```ruby
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 `cancel_by` method.
```ruby
HelloJob.cancel_by(provider_job_id: job_id)
```## Contributing
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](http://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).