Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
b987d52
Allow Rails 5.2 to be used
pixeltrix Apr 9, 2018
5760bf8
Merge pull request #1023 from pixeltrix/allow-rails-5-2
albus522 Apr 13, 2018
84b0004
We don't know for sure the next version will be 6
albus522 Apr 13, 2018
bce6fe3
Rails 5.0 is now unsupported by rails
albus522 Apr 13, 2018
f31546a
Prepare 4.1.5 release
albus522 Apr 13, 2018
f1ec6cb
Remove the Gemnasium badge
albus522 Jun 8, 2018
73bd1b5
Merge pull request #1033 from collectiveidea/remove-gemnasium
albus522 Jun 8, 2018
62acbd5
Replace REMOVED with FAILED in log message
dan-jensen Sep 23, 2018
5b59e9c
Mention Active Job instead of Rails 4.2
toncid Oct 10, 2018
0c2dd3a
Merge pull request #1052 from toncid/patch-1
betamatt Nov 28, 2018
c2df3a3
update doc
Nov 28, 2018
2bb4164
Grammar correction
bitsapien Dec 3, 2018
f59261d
Use modern SVG alternatives of PNG badges
olivierlacan Feb 11, 2019
1c40fb8
Merge pull request #1074 from olivierlacan/patch-2
albus522 Feb 18, 2019
43624b3
Update matrix for ruby and rails updates
albus522 Feb 18, 2019
e0c141b
Rails does not work with sqlite 1.4 before 5.1
albus522 Feb 18, 2019
34ca3c2
Merge pull request #1076 from collectiveidea/fix-travis-setup
albus522 Feb 18, 2019
b1616b2
Merge pull request #1063 from lucianosousa/patch-1
albus522 Feb 18, 2019
7813062
Merge pull request #1064 from bitsapien/patch-2
albus522 Feb 18, 2019
b0adf2c
Merge pull request #1048 from dan-jensen/master
albus522 Feb 18, 2019
43b3591
Properly initialize ActionMailer outside railties
albus522 Feb 18, 2019
460018e
Add a note about ActiveJob callbacks
albus522 Feb 18, 2019
393b268
Bump jruby and the jdk on travis
albus522 Jun 19, 2019
775ce86
Merge pull request #1092 from collectiveidea/bump-travis-jdk
albus522 Jun 19, 2019
7f993da
Fix for change in Psych loading
albus522 Jun 19, 2019
e567824
Merge pull request #1077 from collectiveidea/fix-action-mailer-load
albus522 Jun 19, 2019
11e7b98
Merge pull request #1093 from collectiveidea/fix-yaml-loading
albus522 Jun 19, 2019
dff39e9
Prepare 4.1.6 release
albus522 Jun 19, 2019
bd74058
Fix Delayed::PerformableMailer loading
albus522 Jun 20, 2019
31dfb98
Prepare 4.1.7 release
albus522 Jun 20, 2019
94b4d0b
Allow Rails 6.0
albus522 Feb 18, 2019
0052ece
Rails 6 has deprecated update_attributes
albus522 Feb 18, 2019
032fad0
Start using sqlite 1.4 in testing
albus522 Jun 20, 2019
a2d3fbb
Add Rails 6.0.0 to the build matrix
albus522 Aug 16, 2019
b78f88f
Merge pull request #1078 from collectiveidea/rails-6-compatibility
albus522 Aug 16, 2019
5ac5ade
Prepare 4.1.8 release
albus522 Aug 16, 2019
9db85f9
Add metadata link
viraptor Aug 18, 2019
a346ab8
Fix quoting for rubocop
viraptor Aug 19, 2019
7660286
Make .delay method work with ActionMailer::Parameterized::Mailer
johnnyshields Sep 22, 2020
fc0e9e2
Add specs
johnnyshields Sep 22, 2020
4878fcd
Add to and improve README for Mailers
johnnyshields Sep 22, 2020
75bec31
Fix rubocop
johnnyshields Sep 22, 2020
065fc51
Add Github Action CI
albus522 Dec 8, 2020
80aa67a
Add rubocop Github Action
albus522 Dec 8, 2020
8ad44ac
Remove Travis CI
albus522 Dec 8, 2020
0ca7b4a
Fix simplecov issue
albus522 Dec 8, 2020
1a8f49c
Tweak version handling for cleaner display
albus522 Dec 8, 2020
44412a5
Update build status badge
albus522 Dec 9, 2020
c7809c3
Merge pull request #1128 from collectiveidea/dg-move-to-github-actions
albus522 Dec 9, 2020
1f16417
Allow rails 6.1
albus522 Dec 9, 2020
2b064f7
Pull dev jdbcsqlite3 for edge and rails 6.1
albus522 Dec 9, 2020
59d8178
Merge pull request #1129 from collectiveidea/dg-add-rails-6-1
albus522 Dec 9, 2020
c35dd0f
Merge pull request #1101 from viraptor/patch-1
albus522 Dec 9, 2020
50a0712
Merge pull request #1121 from johnnyshields/patch-3
albus522 Dec 9, 2020
baed6e8
Prepare 4.1.9 release
albus522 Dec 9, 2020
d6bc5cc
Add Rails7 support
willnet Oct 11, 2021
9bd7070
net/smtp isn't bundled by default from Ruby 3.1
willnet Oct 11, 2021
56ae068
Split jruby version with 9.2.x and 9.3.x
willnet Oct 11, 2021
069b642
Add railties to use zeitwerk
willnet Oct 18, 2021
7246e56
net/smtp isn't bundled with Ruby from 3.1.0-dev
willnet Oct 18, 2021
587f501
Fix a warning from rails
willnet Oct 25, 2021
8086462
Fix a broken spec due to Psych >= 4
willnet Oct 25, 2021
da97d70
Fix a dependency error on ruby-head
willnet Oct 25, 2021
7a63bc1
Bump rails from 7.0.0.alpha2 to 7.0.0.rc1
willnet Dec 13, 2021
5accab4
Bump rails from 7.0.0.rc1 to 7.0.0
willnet Dec 20, 2021
aedbbd1
Ruby 3.1 released
willnet Dec 27, 2021
6861d2b
Remove useless gem dependency
willnet Dec 27, 2021
562a460
syck has nothing to do with the pych 4.0
willnet Dec 27, 2021
8a4ad45
Use Rails 7.0.1 instead of 7.0.0 on CI
willnet Jan 17, 2022
462288b
Enclose every ruby version in quotations
willnet Jan 17, 2022
c58252a
Remove duplicated gem dependencies
willnet Jan 17, 2022
8ac60f0
Bring back full matrix
albus522 Jan 17, 2022
bc2c588
Revert "Add railties to use zeitwerk"
albus522 Jan 17, 2022
87ab1a6
Fix remnant comment change
albus522 Jan 17, 2022
8b6fd4b
Expand allowed version to less than 8.0
albus522 Jan 17, 2022
c62b69e
Setup zeitwerk
albus522 Jan 17, 2022
4f4c2e1
Merge pull request #1161 from collectiveidea/dg-fixup-rails-7
albus522 Jan 17, 2022
11e0212
Prepare 4.1.9 release
albus522 Jan 18, 2022
f5624ce
fix: ActiveSupport 7.0.3 Compatibility
arielvalentin May 10, 2022
0ebfebd
Merge pull request #1169 from arielvalentin/as-7.0.3
albus522 Sep 28, 2022
7042b1d
Prepare 4.1.11 release
albus522 Sep 28, 2022
a83d1a4
CI: add Ruby 3.2 to the test matrix
orien Jan 15, 2023
c2f29f3
CI: use JRuby 9.4 to test Rails 7.0 and edge
orien Jan 15, 2023
92fb435
Merge pull request #1183 from envato/ruby3.2
albus522 Jan 16, 2023
4dfb33d
allowing 6.2 versions
swatikri-ht Jul 18, 2023
35c8cf8
fix conflicts
swatikri-ht Jul 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ['2.7', '3.0', '3.1', '3.2', jruby-head, ruby-head]
rails_version:
- '6.0.0'
- '6.1.0'
- '7.0.0'
- 'edge'
include:
# Rails 5.2
- ruby: 2.6
rails_version: '5.2.0'
- ruby: 2.7
rails_version: '5.2.0'
- ruby: jruby-9.2
rails_version: '5.2.0'

# Ruby 2.6
- ruby: 2.6
rails_version: '6.0.0'
- ruby: 2.6
rails_version: '6.1.0'

# jruby-9.2
- ruby: jruby-9.2
rails_version: '6.0.0'
- ruby: jruby-9.2
rails_version: '6.1.0'

# jruby-9.4
- ruby: jruby-9.4
rails_version: '7.0.0'
- ruby: jruby-9.4
rails_version: 'edge'

#
# The past
#
# EOL Active Record
- ruby: 2.2
rails_version: '3.2.0'
- ruby: 2.1
rails_version: '4.1.0'
- ruby: 2.4
rails_version: '4.2.0'
- ruby: 2.4
rails_version: '5.0.0'
- ruby: 2.5
rails_version: '5.1.0'

continue-on-error: ${{ matrix.rails_version == 'edge' || endsWith(matrix.ruby, 'head') }}

steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
env:
RAILS_VERSION: ${{ matrix.rails_version }}
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run tests
env:
RAILS_VERSION: ${{ matrix.rails_version }}
run: bundle exec rspec
- name: Coveralls Parallel
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
flag-name: run-${{ matrix.ruby }}-${{ matrix.rails_version }}
parallel: true

finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
30 changes: 30 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: RuboCop

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Ruby 2.7
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Generate lockfile for cache key
run: bundle lock
- name: Cache gems
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-rubocop-
- name: Install gems
run: |
bundle config path vendor/bundle
bundle config set without 'default test'
bundle install --jobs 4 --retry 3
- name: Run RuboCop
run: bundle exec rubocop
51 changes: 0 additions & 51 deletions .travis.yml

This file was deleted.

36 changes: 34 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,42 @@
4.1.11 - 2022-09-28
===================
* Fix missing require for Rails 7.0.3+

4.1.10 - 2022-01-17
===================
* Support for Rails 7.0. NOTE: If you are using Delayed Job independent of Rails, Active Support 7 has dropped classic dependency autoloading. You will need to add and setup zeitwerk for autoloading to continue working in ActiveSupport 7.

4.1.9 - 2020-12-09
==================
* Support for Rails 6.1
* Add support for parameterized mailers via delay call (#1121)

4.1.8 - 2019-08-16
==================
* Support for Rails 6.0.0

4.1.7 - 2019-06-20
==================
* Fix loading Delayed::PerformableMailer when ActionMailer isn't loaded yet

4.1.6 - 2019-06-19
==================
* Properly initialize ActionMailer outside railties (#1077)
* Fix Psych load_tags support (#1093)
* Replace REMOVED with FAILED in log message (#1048)
* Misc doc updates (#1052, #1074, #1064, #1063)

4.1.5 - 2018-04-13
==================
* Allow Rails 5.2

4.1.4 - 2017-12-29
=================
==================
* Use `yaml_tag` instead of deprecated `yaml_as` (#996)
* Support ruby 2.5.0

4.1.3 - 2017-05-26
=================
==================
* Don't mutate the options hash (#877)
* Log an error message when a deserialization error occurs (#894)
* Adding the queue name to the log output (#917)
Expand Down
49 changes: 41 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,40 @@ source 'https://rubygems.org'
gem 'rake'

platforms :ruby do
gem 'sqlite3'
# Rails 5.1 is the first to work with sqlite 1.4
# Rails 6 now requires sqlite 1.4
if ENV['RAILS_VERSION'] && ENV['RAILS_VERSION'] < '5.1'
gem 'sqlite3', '< 1.4'
else
gem 'sqlite3'
end
end

platforms :jruby do
if ENV['RAILS_VERSION'] == '~> 4.2.0'
if ENV['RAILS_VERSION'] == '4.2.0'
gem 'activerecord-jdbcsqlite3-adapter', '< 50.0'
elsif ENV['RAILS_VERSION'] == '5.0.0'
gem 'activerecord-jdbcsqlite3-adapter', '~> 50.0'
elsif ENV['RAILS_VERSION'] == '5.1.0'
gem 'activerecord-jdbcsqlite3-adapter', '~> 51.0'
elsif ENV['RAILS_VERSION'] == '5.2.0'
gem 'activerecord-jdbcsqlite3-adapter', '~> 52.0'
elsif ENV['RAILS_VERSION'] == '6.0.0'
gem 'activerecord-jdbcsqlite3-adapter', '~> 60.0'
elsif ENV['RAILS_VERSION'] == '6.1.0'
gem 'activerecord-jdbcsqlite3-adapter', '~> 61.0'
else
gem 'activerecord-jdbcsqlite3-adapter'
end
gem 'jruby-openssl'
gem 'mime-types', ['~> 2.6', '< 2.99']

if ENV['RAILS_VERSION'] == 'edge'
gem 'railties', :github => 'rails/rails'
elsif ENV['RAILS_VERSION']
gem 'railties', "~> #{ENV['RAILS_VERSION']}"
else
gem 'railties', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.2'])
gem 'railties', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 6.2'])
end
end

Expand All @@ -29,15 +48,29 @@ group :test do
if ENV['RAILS_VERSION'] == 'edge'
gem 'actionmailer', :github => 'rails/rails'
gem 'activerecord', :github => 'rails/rails'
elsif ENV['RAILS_VERSION']
gem 'actionmailer', "~> #{ENV['RAILS_VERSION']}"
gem 'activerecord', "~> #{ENV['RAILS_VERSION']}"
else
gem 'actionmailer', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.2'])
gem 'activerecord', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 5.2'])
gem 'actionmailer', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 6.2'])
gem 'activerecord', (ENV['RAILS_VERSION'] || ['>= 3.0', '< 6.2'])
end

gem 'coveralls', :require => false
gem 'net-smtp' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.1.0')
gem 'rspec', '>= 3'
gem 'simplecov', :require => false
if /\A2.[12]/ =~ RUBY_VERSION
# 0.8.0 doesn't work with simplecov < 0.18.0 and older ruby can't run 0.18.0
gem 'simplecov-lcov', '< 0.8.0', :require => false
else
gem 'simplecov-lcov', :require => false
end
if ENV['RAILS_VERSION'].nil? || ENV['RAILS_VERSION'] >= '6.0.0'
gem 'zeitwerk', :require => false
end
end

group :rubocop do
gem 'rubocop', '>= 0.25', '< 0.49'
gem 'simplecov', '>= 0.9'
end

gemspec
43 changes: 24 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
**If you're viewing this at https://github.com/collectiveidea/delayed_job,
you're reading the documentation for the master branch.
[View documentation for the latest release
(4.1.4).](https://github.com/collectiveidea/delayed_job/tree/v4.1.4)**
(4.1.11).](https://github.com/collectiveidea/delayed_job/tree/v4.1.11)**

Delayed::Job
============
[![Gem Version](https://badge.fury.io/rb/delayed_job.png)][gem]
[![Build Status](https://travis-ci.org/collectiveidea/delayed_job.png?branch=master)][travis]
[![Dependency Status](https://gemnasium.com/collectiveidea/delayed_job.png?travis)][gemnasium]
[![Code Climate](https://codeclimate.com/github/collectiveidea/delayed_job.png)][codeclimate]
[![Coverage Status](https://coveralls.io/repos/collectiveidea/delayed_job/badge.png?branch=master)][coveralls]
[![Gem Version](https://badge.fury.io/rb/delayed_job.svg)][gem]
![CI](https://github.com/collectiveidea/delayed_job/workflows/CI/badge.svg)
[![Code Climate](https://codeclimate.com/github/collectiveidea/delayed_job.svg)][codeclimate]
[![Coverage Status](https://coveralls.io/repos/collectiveidea/delayed_job/badge.svg?branch=master)][coveralls]

[gem]: https://rubygems.org/gems/delayed_job
[travis]: https://travis-ci.org/collectiveidea/delayed_job
[gemnasium]: https://gemnasium.com/collectiveidea/delayed_job
[codeclimate]: https://codeclimate.com/github/collectiveidea/delayed_job
[coveralls]: https://coveralls.io/r/collectiveidea/delayed_job

Expand Down Expand Up @@ -62,16 +59,16 @@ running the following command:
rails generate delayed_job:active_record
rake db:migrate

For Rails 4.2, see [below](#rails-42)
For Rails 4.2+, see [below](#active-job)

Development
===========
In development mode, if you are using Rails 3.1+, your application code will automatically reload every 100 jobs or when the queue finishes.
You no longer need to restart Delayed Job every time you update your code in development.

Rails 4.2
=========
Set the queue_adapter in config/application.rb
Active Job
==========
In Rails 4.2+, set the queue_adapter in config/application.rb

```ruby
config.active_job.queue_adapter = :delayed_job
Expand Down Expand Up @@ -170,9 +167,10 @@ end

If you ever want to call a `handle_asynchronously`'d method without Delayed Job, for instance while debugging something at the console, just add `_without_delay` to the method name. For instance, if your original method was `foo`, then call `foo_without_delay`.

Rails 3 Mailers
===============
Due to how mailers are implemented in Rails 3, we had to do a little work around to get delayed_job to work.
Rails Mailers
=============
Delayed Job uses special syntax for Rails Mailers.
Do not call the `.deliver` method when using `.delay`.

```ruby
# without delayed_job
Expand All @@ -181,12 +179,16 @@ Notifier.signup(@user).deliver
# with delayed_job
Notifier.delay.signup(@user)

# with delayed_job running at a specific time
# delayed_job running at a specific time
Notifier.delay(run_at: 5.minutes.from_now).signup(@user)

# when using parameters, the .with method must be called before the .delay method
Notifier.with(foo: 1, bar: 2).delay.signup(@user)
```

Remove the `.deliver` method to make it work. It's not ideal, but it's the best
we could do for now.
You may also wish to consider using
[Active Job with Action Mailer](https://edgeguides.rubyonrails.org/active_job_basics.html#action-mailer)
which provides convenient `.deliver_later` syntax that forwards to Delayed Job under-the-hood.

Named Queues
============
Expand Down Expand Up @@ -377,6 +379,9 @@ Hooks
=====
You can define hooks on your job that will be called at different stages in the process:


**NOTE:** If you are using ActiveJob these hooks are **not** available to your jobs. You will need to use ActiveJob's callbacks. You can find details here https://guides.rubyonrails.org/active_job_basics.html#callbacks

```ruby
class ParanoidNewsletterJob < NewsletterJob
def enqueue(job)
Expand Down Expand Up @@ -430,7 +435,7 @@ end

On error, the job is scheduled again in 5 seconds + N ** 4, where N is the number of attempts or using the job's defined `reschedule_at` method.

The default `Worker.max_attempts` is 25. After this, the job either deleted (default), or left in the database with "failed_at" set.
The default `Worker.max_attempts` is 25. After this, the job is either deleted (default), or left in the database with "failed_at" set.
With the default of 25 attempts, the last retry will be 20 days later, with the last interval being almost 100 hours.

The default `Worker.max_run_time` is 4.hours. If your job takes longer than that, another computer could pick it up. It's up to you to
Expand Down
Loading