delayed_job 4.1.7 → 4.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a15a5e7e0c1382d5f185cf7eb769e9138acd18d6dafe52d5ef5c2590b0f172f
4
- data.tar.gz: f6da61d248326cf6ceab395fe074aa06040efa2b8e75aafc41e4f39c91871106
3
+ metadata.gz: a3ba5417c14434bc0118cd8fea79d9203e7e1b372d1b9d0a4975cfa641014194
4
+ data.tar.gz: 8f232109cfee54e7d15777529998927ab5b286d53d1c37573c407a31e8cbbcc8
5
5
  SHA512:
6
- metadata.gz: 33b36ea1a9a374324bfb366203f9b9bb9dee7f7a002e561c0b1c8ddfb022bd1201512622186a093b64bd06d0261240435cffe6734911af13052705a602b35f13
7
- data.tar.gz: 8847b2a7031c76622ddd6ac2f805f3129f8c5970417fa961a88022fd24b04f362ed17739e0c23419b8a1bfa62ac8fc9e0be410c5ee3760508d92a1865654d656
6
+ metadata.gz: 6ef347b8c7a4408580e89fa38a6c44d3570907a72eb0219b5eac851fcadd22c206b2c266a2ec53532c909e6bceb7f0d826e8035532de17d165ad8552e5cf0bf4
7
+ data.tar.gz: 7d15bb2a110efc5f04c22030cb14da4bee655545f79748af68e0ab130a8993b849189df66be860594f6e1060e4e02947e68054a37c7959f116960c1f15262159
data/CHANGELOG.md CHANGED
@@ -1,25 +1,38 @@
1
+ 4.1.10 - 2022-01-17
2
+ ===================
3
+ * 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
+
5
+ 4.1.9 - 2020-12-09
6
+ ==================
7
+ * Support for Rails 6.1
8
+ * Add support for parameterized mailers via delay call (#1121)
9
+
10
+ 4.1.8 - 2019-08-16
11
+ ==================
12
+ * Support for Rails 6.0.0
13
+
1
14
  4.1.7 - 2019-06-20
2
- =================
15
+ ==================
3
16
  * Fix loading Delayed::PerformableMailer when ActionMailer isn't loaded yet
4
17
 
5
18
  4.1.6 - 2019-06-19
6
- =================
19
+ ==================
7
20
  * Properly initialize ActionMailer outside railties (#1077)
8
21
  * Fix Psych load_tags support (#1093)
9
22
  * Replace REMOVED with FAILED in log message (#1048)
10
23
  * Misc doc updates (#1052, #1074, #1064, #1063)
11
24
 
12
25
  4.1.5 - 2018-04-13
13
- =================
26
+ ==================
14
27
  * Allow Rails 5.2
15
28
 
16
29
  4.1.4 - 2017-12-29
17
- =================
30
+ ==================
18
31
  * Use `yaml_tag` instead of deprecated `yaml_as` (#996)
19
32
  * Support ruby 2.5.0
20
33
 
21
34
  4.1.3 - 2017-05-26
22
- =================
35
+ ==================
23
36
  * Don't mutate the options hash (#877)
24
37
  * Log an error message when a deserialization error occurs (#894)
25
38
  * Adding the queue name to the log output (#917)
data/README.md CHANGED
@@ -1,17 +1,16 @@
1
1
  **If you're viewing this at https://github.com/collectiveidea/delayed_job,
2
2
  you're reading the documentation for the master branch.
3
3
  [View documentation for the latest release
4
- (4.1.7).](https://github.com/collectiveidea/delayed_job/tree/v4.1.7)**
4
+ (4.1.10).](https://github.com/collectiveidea/delayed_job/tree/v4.1.10)**
5
5
 
6
6
  Delayed::Job
7
7
  ============
8
8
  [![Gem Version](https://badge.fury.io/rb/delayed_job.svg)][gem]
9
- [![Build Status](https://travis-ci.org/collectiveidea/delayed_job.svg?branch=master)][travis]
9
+ ![CI](https://github.com/collectiveidea/delayed_job/workflows/CI/badge.svg)
10
10
  [![Code Climate](https://codeclimate.com/github/collectiveidea/delayed_job.svg)][codeclimate]
11
11
  [![Coverage Status](https://coveralls.io/repos/collectiveidea/delayed_job/badge.svg?branch=master)][coveralls]
12
12
 
13
13
  [gem]: https://rubygems.org/gems/delayed_job
14
- [travis]: https://travis-ci.org/collectiveidea/delayed_job
15
14
  [codeclimate]: https://codeclimate.com/github/collectiveidea/delayed_job
16
15
  [coveralls]: https://coveralls.io/r/collectiveidea/delayed_job
17
16
 
@@ -168,9 +167,10 @@ end
168
167
 
169
168
  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`.
170
169
 
171
- Rails 3 Mailers
172
- ===============
173
- Due to how mailers are implemented in Rails 3, we had to do a little work around to get delayed_job to work.
170
+ Rails Mailers
171
+ =============
172
+ Delayed Job uses special syntax for Rails Mailers.
173
+ Do not call the `.deliver` method when using `.delay`.
174
174
 
175
175
  ```ruby
176
176
  # without delayed_job
@@ -179,12 +179,16 @@ Notifier.signup(@user).deliver
179
179
  # with delayed_job
180
180
  Notifier.delay.signup(@user)
181
181
 
182
- # with delayed_job running at a specific time
182
+ # delayed_job running at a specific time
183
183
  Notifier.delay(run_at: 5.minutes.from_now).signup(@user)
184
+
185
+ # when using parameters, the .with method must be called before the .delay method
186
+ Notifier.with(foo: 1, bar: 2).delay.signup(@user)
184
187
  ```
185
188
 
186
- Remove the `.deliver` method to make it work. It's not ideal, but it's the best
187
- we could do for now.
189
+ You may also wish to consider using
190
+ [Active Job with Action Mailer](https://edgeguides.rubyonrails.org/active_job_basics.html#action-mailer)
191
+ which provides convenient `.deliver_later` syntax that forwards to Delayed Job under-the-hood.
188
192
 
189
193
  Named Queues
190
194
  ============
data/delayed_job.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Gem::Specification.new do |spec|
4
- spec.add_dependency 'activesupport', ['>= 3.0', '< 5.3']
4
+ spec.add_dependency 'activesupport', ['>= 3.0', '< 8.0']
5
5
  spec.authors = ['Brandon Keepers', 'Brian Ryckbost', 'Chris Gaffney', 'David Genord II', 'Erik Michaels-Ober', 'Matt Griffin', 'Steve Richert', 'Tobias Lütke']
6
6
  spec.description = 'Delayed_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background. It is a direct extraction from Shopify where the job table is responsible for a multitude of core tasks.'
7
7
  spec.email = ['brian@collectiveidea.com']
@@ -13,5 +13,10 @@ Gem::Specification.new do |spec|
13
13
  spec.require_paths = ['lib']
14
14
  spec.summary = 'Database-backed asynchronous priority queue system -- Extracted from Shopify'
15
15
  spec.test_files = Dir.glob('spec/**/*')
16
- spec.version = '4.1.7'
16
+ spec.version = '4.1.10'
17
+ spec.metadata = {
18
+ 'changelog_uri' => 'https://github.com/collectiveidea/delayed_job/blob/master/CHANGELOG.md',
19
+ 'bug_tracker_uri' => 'https://github.com/collectiveidea/delayed_job/issues',
20
+ 'source_code_uri' => 'https://github.com/collectiveidea/delayed_job'
21
+ }
17
22
  end
@@ -133,7 +133,8 @@ module Delayed
133
133
  end
134
134
 
135
135
  def fail!
136
- update_attributes(:failed_at => self.class.db_time_now)
136
+ self.failed_at = self.class.db_time_now
137
+ save!
137
138
  end
138
139
 
139
140
  protected
@@ -523,7 +523,8 @@ shared_examples_for 'a delayed_job backend' do
523
523
  it 'reloads changed attributes' do
524
524
  story = Story.create(:text => 'hello')
525
525
  job = story.delay.tell
526
- story.update_attributes :text => 'goodbye'
526
+ story.text = 'goodbye'
527
+ story.save!
527
528
  expect(job.reload.payload_object.object.text).to eq('goodbye')
528
529
  end
529
530
 
data/lib/delayed_job.rb CHANGED
@@ -16,6 +16,7 @@ require 'delayed/railtie' if defined?(Rails::Railtie)
16
16
  ActiveSupport.on_load(:action_mailer) do
17
17
  require 'delayed/performable_mailer'
18
18
  ActionMailer::Base.extend(Delayed::DelayMail)
19
+ ActionMailer::Parameterized::Mailer.include(Delayed::DelayMail) if defined?(ActionMailer::Parameterized::Mailer)
19
20
  end
20
21
 
21
22
  module Delayed
@@ -87,11 +87,6 @@ module Delayed
87
87
  Time.current
88
88
  end
89
89
 
90
- def update_attributes(attrs = {})
91
- attrs.each { |k, v| send(:"#{k}=", v) }
92
- save
93
- end
94
-
95
90
  def destroy
96
91
  self.class.all.delete(self)
97
92
  end
data/spec/helper.rb CHANGED
@@ -1,13 +1,19 @@
1
1
  require 'simplecov'
2
- require 'coveralls'
2
+ require 'simplecov-lcov'
3
3
 
4
- SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
4
+ SimpleCov::Formatter::LcovFormatter.config do |c|
5
+ c.report_with_single_file = true
6
+ c.single_report_path = 'coverage/lcov.info'
7
+ end
8
+ SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
9
+ [
10
+ SimpleCov::Formatter::HTMLFormatter,
11
+ SimpleCov::Formatter::LcovFormatter
12
+ ]
13
+ )
5
14
 
6
15
  SimpleCov.start do
7
16
  add_filter '/spec/'
8
- # Each version of ruby and version of rails test different things
9
- # This should probably just be removed.
10
- minimum_coverage(85.0)
11
17
  end
12
18
 
13
19
  require 'logger'
@@ -41,8 +47,21 @@ end
41
47
 
42
48
  Delayed::Worker.backend = :test
43
49
 
44
- # Add this directory so the ActiveSupport autoloading works
45
- ActiveSupport::Dependencies.autoload_paths << File.dirname(__FILE__)
50
+ if ActiveSupport::VERSION::MAJOR < 7
51
+ require 'active_support/dependencies'
52
+
53
+ # Add this directory so the ActiveSupport autoloading works
54
+ ActiveSupport::Dependencies.autoload_paths << File.dirname(__FILE__)
55
+ else
56
+ # Rails 7 dropped classic dependency auto-loading. This does a basic
57
+ # zeitwerk setup to test against zeitwerk directly as the Rails zeitwerk
58
+ # setup is intertwined in the application boot process.
59
+ require 'zeitwerk'
60
+
61
+ loader = Zeitwerk::Loader.new
62
+ loader.push_dir File.dirname(__FILE__)
63
+ loader.setup
64
+ end
46
65
 
47
66
  # Used to test interactions between DJ and an ORM
48
67
  ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => ':memory:'
@@ -40,3 +40,29 @@ describe ActionMailer::Base do
40
40
  end
41
41
  end
42
42
  end
43
+
44
+ if defined?(ActionMailer::Parameterized::Mailer)
45
+ describe ActionMailer::Parameterized::Mailer do
46
+ describe 'delay' do
47
+ it 'enqueues a PerformableEmail job' do
48
+ expect do
49
+ job = MyMailer.with(:foo => 1, :bar => 2).delay.signup('john@example.com')
50
+ expect(job.payload_object.class).to eq(Delayed::PerformableMailer)
51
+ expect(job.payload_object.object.class).to eq(ActionMailer::Parameterized::Mailer)
52
+ expect(job.payload_object.object.instance_variable_get('@mailer')).to eq(MyMailer)
53
+ expect(job.payload_object.object.instance_variable_get('@params')).to eq(:foo => 1, :bar => 2)
54
+ expect(job.payload_object.method_name).to eq(:signup)
55
+ expect(job.payload_object.args).to eq(['john@example.com'])
56
+ end.to change { Delayed::Job.count }.by(1)
57
+ end
58
+ end
59
+
60
+ describe 'delay on a mail object' do
61
+ it 'raises an exception' do
62
+ expect do
63
+ MyMailer.with(:foo => 1, :bar => 2).signup('john@example.com').delay
64
+ end.to raise_error(RuntimeError)
65
+ end
66
+ end
67
+ end
68
+ end
@@ -25,7 +25,7 @@ describe 'YAML' do
25
25
  it 'autoloads the class of an anonymous struct' do
26
26
  expect do
27
27
  yaml = "--- !ruby/struct\nn: 1\n"
28
- object = YAML.load(yaml)
28
+ object = load_with_delayed_visitor(yaml)
29
29
  expect(object).to be_kind_of(Struct)
30
30
  expect(object.n).to eq(1)
31
31
  end.not_to raise_error
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.7
4
+ version: 4.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Keepers
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2019-06-20 00:00:00.000000000 Z
18
+ date: 2022-01-18 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activesupport
@@ -26,7 +26,7 @@ dependencies:
26
26
  version: '3.0'
27
27
  - - "<"
28
28
  - !ruby/object:Gem::Version
29
- version: '5.3'
29
+ version: '8.0'
30
30
  type: :runtime
31
31
  prerelease: false
32
32
  version_requirements: !ruby/object:Gem::Requirement
@@ -36,7 +36,7 @@ dependencies:
36
36
  version: '3.0'
37
37
  - - "<"
38
38
  - !ruby/object:Gem::Version
39
- version: '5.3'
39
+ version: '8.0'
40
40
  description: Delayed_job (or DJ) encapsulates the common pattern of asynchronously
41
41
  executing longer tasks in the background. It is a direct extraction from Shopify
42
42
  where the job table is responsible for a multitude of core tasks.
@@ -102,7 +102,10 @@ files:
102
102
  homepage: http://github.com/collectiveidea/delayed_job
103
103
  licenses:
104
104
  - MIT
105
- metadata: {}
105
+ metadata:
106
+ changelog_uri: https://github.com/collectiveidea/delayed_job/blob/master/CHANGELOG.md
107
+ bug_tracker_uri: https://github.com/collectiveidea/delayed_job/issues
108
+ source_code_uri: https://github.com/collectiveidea/delayed_job
106
109
  post_install_message:
107
110
  rdoc_options: []
108
111
  require_paths:
@@ -118,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
121
  - !ruby/object:Gem::Version
119
122
  version: '0'
120
123
  requirements: []
121
- rubygems_version: 3.0.3
124
+ rubygems_version: 3.1.4
122
125
  signing_key:
123
126
  specification_version: 4
124
127
  summary: Database-backed asynchronous priority queue system -- Extracted from Shopify