activejob 6.0.0.beta3 → 6.0.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -1
- data/README.md +5 -4
- data/lib/active_job/enqueuing.rb +1 -1
- data/lib/active_job/exceptions.rb +13 -6
- data/lib/active_job/gem_version.rb +1 -1
- data/lib/active_job/queue_adapters.rb +3 -3
- data/lib/active_job/test_helper.rb +16 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e59e7551edf579418f0d3e6d6e74ff4c1750e0114c6a59b4218df2ad7f18304
|
4
|
+
data.tar.gz: 2b7296a21d44985536e994f483159d466f98e779b9a135d44d4b5c7954fd71d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2aa71b2541105abd834b5f8b631de9c32f882142ad5758ea841b619fb83848f82e66bb297842de63a1ddea87478c0adac1218dc032d7db2c112e27779d3a192a
|
7
|
+
data.tar.gz: c3a736d86de568987f2bc404c290258a59c4b09975c38097c9796a24fb8ff1ed1ce3e8cb0ddebdcf421b31eee53fc626e52d3bf6b99064fd7ac99eaae4fc3f47
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## Rails 6.0.0.rc1 (April 24, 2019) ##
|
2
|
+
|
3
|
+
* Use individual execution counters when calculating retry delay.
|
4
|
+
|
5
|
+
*Patrik Bóna*
|
6
|
+
|
7
|
+
* Make job argument assertions with `Time`, `ActiveSupport::TimeWithZone`, and `DateTime` work by dropping microseconds. Microsecond precision is lost during serialization.
|
8
|
+
|
9
|
+
*Gannon McGibbon*
|
10
|
+
|
11
|
+
|
1
12
|
## Rails 6.0.0.beta3 (March 11, 2019) ##
|
2
13
|
|
3
14
|
* No changes.
|
@@ -29,7 +40,7 @@
|
|
29
40
|
|
30
41
|
*Edouard Chin*
|
31
42
|
|
32
|
-
* Restore HashWithIndifferentAccess support to ActiveJob::Arguments.deserialize
|
43
|
+
* Restore `HashWithIndifferentAccess` support to `ActiveJob::Arguments.deserialize`.
|
33
44
|
|
34
45
|
*Gannon McGibbon*
|
35
46
|
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Active Job
|
1
|
+
# Active Job – Make work happen later
|
2
2
|
|
3
3
|
Active Job is a framework for declaring jobs and making them run on a variety
|
4
4
|
of queuing backends. These jobs can be everything from regularly scheduled
|
@@ -17,12 +17,13 @@ about API differences between Delayed Job and Resque. Picking your queuing
|
|
17
17
|
backend becomes more of an operational concern, then. And you'll be able to
|
18
18
|
switch between them without having to rewrite your jobs.
|
19
19
|
|
20
|
+
You can read more about Active Job in the [Active Job Basics](https://edgeguides.rubyonrails.org/active_job_basics.html) guide.
|
20
21
|
|
21
22
|
## Usage
|
22
23
|
|
23
24
|
To learn how to use your preferred queuing backend see its adapter
|
24
25
|
documentation at
|
25
|
-
[ActiveJob::QueueAdapters](
|
26
|
+
[ActiveJob::QueueAdapters](https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters.html).
|
26
27
|
|
27
28
|
Declare a job like so:
|
28
29
|
|
@@ -86,7 +87,7 @@ by default has been mixed into Active Record classes.
|
|
86
87
|
|
87
88
|
Active Job has built-in adapters for multiple queuing backends (Sidekiq,
|
88
89
|
Resque, Delayed Job and others). To get an up-to-date list of the adapters
|
89
|
-
see the API Documentation for [ActiveJob::QueueAdapters](
|
90
|
+
see the API Documentation for [ActiveJob::QueueAdapters](https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters.html).
|
90
91
|
|
91
92
|
**Please note:** We are not accepting pull requests for new adapters. We
|
92
93
|
encourage library authors to provide an ActiveJob adapter as part of
|
@@ -121,7 +122,7 @@ Active Job is released under the MIT license:
|
|
121
122
|
|
122
123
|
API documentation is at:
|
123
124
|
|
124
|
-
*
|
125
|
+
* https://api.rubyonrails.org
|
125
126
|
|
126
127
|
Bug reports for the Ruby on Rails project can be filed here:
|
127
128
|
|
data/lib/active_job/enqueuing.rb
CHANGED
@@ -67,7 +67,7 @@ module ActiveJob
|
|
67
67
|
false
|
68
68
|
else
|
69
69
|
ActiveSupport::Deprecation.warn(
|
70
|
-
"Rails 6.
|
70
|
+
"Rails 6.1 will return false when the enqueuing is aborted. Make sure your code doesn't depend on it" \
|
71
71
|
" returning the instance of the job and set `config.active_job.return_false_on_aborted_enqueue = true`" \
|
72
72
|
" to remove the deprecations."
|
73
73
|
)
|
@@ -49,12 +49,10 @@ module ActiveJob
|
|
49
49
|
# end
|
50
50
|
def retry_on(*exceptions, wait: 3.seconds, attempts: 5, queue: nil, priority: nil)
|
51
51
|
rescue_from(*exceptions) do |error|
|
52
|
-
|
53
|
-
self.exception_executions ||= {}
|
54
|
-
self.exception_executions[exceptions.to_s] = (exception_executions[exceptions.to_s] || 0) + 1
|
52
|
+
executions = executions_for(exceptions)
|
55
53
|
|
56
|
-
if
|
57
|
-
retry_job wait: determine_delay(wait), queue: queue, priority: priority, error: error
|
54
|
+
if executions < attempts
|
55
|
+
retry_job wait: determine_delay(seconds_or_duration_or_algorithm: wait, executions: executions), queue: queue, priority: priority, error: error
|
58
56
|
else
|
59
57
|
if block_given?
|
60
58
|
instrument :retry_stopped, error: error do
|
@@ -123,7 +121,7 @@ module ActiveJob
|
|
123
121
|
end
|
124
122
|
|
125
123
|
private
|
126
|
-
def determine_delay(seconds_or_duration_or_algorithm)
|
124
|
+
def determine_delay(seconds_or_duration_or_algorithm:, executions:)
|
127
125
|
case seconds_or_duration_or_algorithm
|
128
126
|
when :exponentially_longer
|
129
127
|
(executions**4) + 2
|
@@ -146,5 +144,14 @@ module ActiveJob
|
|
146
144
|
|
147
145
|
ActiveSupport::Notifications.instrument("#{name}.active_job", payload, &block)
|
148
146
|
end
|
147
|
+
|
148
|
+
def executions_for(exceptions)
|
149
|
+
if exception_executions
|
150
|
+
exception_executions[exceptions.to_s] = (exception_executions[exceptions.to_s] || 0) + 1
|
151
|
+
else
|
152
|
+
# Guard against jobs that were persisted before we started having individual executions counters per retry_on
|
153
|
+
executions
|
154
|
+
end
|
155
|
+
end
|
149
156
|
end
|
150
157
|
end
|
@@ -10,11 +10,11 @@ module ActiveJob
|
|
10
10
|
# * {Que}[https://github.com/chanks/que]
|
11
11
|
# * {queue_classic}[https://github.com/QueueClassic/queue_classic]
|
12
12
|
# * {Resque}[https://github.com/resque/resque]
|
13
|
-
# * {Sidekiq}[
|
13
|
+
# * {Sidekiq}[https://sidekiq.org]
|
14
14
|
# * {Sneakers}[https://github.com/jondot/sneakers]
|
15
15
|
# * {Sucker Punch}[https://github.com/brandonhilkert/sucker_punch]
|
16
|
-
# * {Active Job Async Job}[
|
17
|
-
# * {Active Job Inline}[
|
16
|
+
# * {Active Job Async Job}[https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters/AsyncAdapter.html]
|
17
|
+
# * {Active Job Inline}[https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters/InlineAdapter.html]
|
18
18
|
# * Please Note: We are not accepting pull requests for new adapters. See the {README}[link:files/activejob/README_md.html] for more details.
|
19
19
|
#
|
20
20
|
# === Backends Features
|
@@ -353,7 +353,7 @@ module ActiveJob
|
|
353
353
|
#
|
354
354
|
#
|
355
355
|
# The +args+ argument also accepts a proc which will get passed the actual
|
356
|
-
# job's arguments. Your proc needs to
|
356
|
+
# job's arguments. Your proc needs to return a boolean value determining if
|
357
357
|
# the job's arguments matches your expectation. This is useful to check only
|
358
358
|
# for a subset of arguments.
|
359
359
|
#
|
@@ -426,7 +426,7 @@ module ActiveJob
|
|
426
426
|
# end
|
427
427
|
#
|
428
428
|
# The +args+ argument also accepts a proc which will get passed the actual
|
429
|
-
# job's arguments. Your proc needs to
|
429
|
+
# job's arguments. Your proc needs to return a boolean value determining if
|
430
430
|
# the job's arguments matches your expectation. This is useful to check only
|
431
431
|
# for a subset of arguments.
|
432
432
|
#
|
@@ -631,6 +631,20 @@ module ActiveJob
|
|
631
631
|
def prepare_args_for_assertion(args)
|
632
632
|
args.dup.tap do |arguments|
|
633
633
|
arguments[:at] = arguments[:at].to_f if arguments[:at]
|
634
|
+
arguments[:args] = round_time_arguments(arguments[:args]) if arguments[:args]
|
635
|
+
end
|
636
|
+
end
|
637
|
+
|
638
|
+
def round_time_arguments(argument)
|
639
|
+
case argument
|
640
|
+
when Time, ActiveSupport::TimeWithZone, DateTime
|
641
|
+
argument.change(usec: 0)
|
642
|
+
when Hash
|
643
|
+
argument.transform_values { |value| round_time_arguments(value) }
|
644
|
+
when Array
|
645
|
+
argument.map { |element| round_time_arguments(element) }
|
646
|
+
else
|
647
|
+
argument
|
634
648
|
end
|
635
649
|
end
|
636
650
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activejob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.0.
|
4
|
+
version: 6.0.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 6.0.0.
|
19
|
+
version: 6.0.0.rc1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 6.0.0.
|
26
|
+
version: 6.0.0.rc1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: globalid
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,12 +90,12 @@ files:
|
|
90
90
|
- lib/rails/generators/job/job_generator.rb
|
91
91
|
- lib/rails/generators/job/templates/application_job.rb.tt
|
92
92
|
- lib/rails/generators/job/templates/job.rb.tt
|
93
|
-
homepage:
|
93
|
+
homepage: https://rubyonrails.org
|
94
94
|
licenses:
|
95
95
|
- MIT
|
96
96
|
metadata:
|
97
|
-
source_code_uri: https://github.com/rails/rails/tree/v6.0.0.
|
98
|
-
changelog_uri: https://github.com/rails/rails/blob/v6.0.0.
|
97
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.0.0.rc1/activejob
|
98
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.0.0.rc1/activejob/CHANGELOG.md
|
99
99
|
post_install_message:
|
100
100
|
rdoc_options: []
|
101
101
|
require_paths:
|