activejob 5.2.0 → 5.2.1.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 +8 -0
- data/lib/active_job/core.rb +16 -4
- data/lib/active_job/exceptions.rb +5 -5
- data/lib/active_job/gem_version.rb +2 -2
- metadata +9 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 56e0ed051fab0bb338aad0e7e2c711cc02e16735780453ac4c0c6667bef6cde0
|
|
4
|
+
data.tar.gz: 74eebf584043dcd44d16b79471c11d618e5a40fede93e0dc113f061a691dd4f1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 17f4cab310d256155278516934c1a8df1443757278620482bc5fb9b5d0947e4786cb73990c9865ced7b9b4b455f254d2983879671db71b9bf4affd7214c9efd7
|
|
7
|
+
data.tar.gz: aa25a9bd28a234095952cab17360a693f0593cdca5077705fa77899ae213c2526c65ec0576251979bc907479237b94ed3fa7c5a7bd889a80fd27df4b56d42ddb
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## Rails 5.2.1.rc1 (July 30, 2018) ##
|
|
2
|
+
|
|
3
|
+
* Pass the error instance as the second parameter of block executed by `discard_on`.
|
|
4
|
+
|
|
5
|
+
Fixes #32853.
|
|
6
|
+
|
|
7
|
+
*Yuji Yaginuma*
|
|
8
|
+
|
|
1
9
|
## Rails 5.2.0 (April 09, 2018) ##
|
|
2
10
|
|
|
3
11
|
* Allow block to be passed to `ActiveJob::Base.discard_on` to allow custom handling of discard jobs.
|
data/lib/active_job/core.rb
CHANGED
|
@@ -85,7 +85,7 @@ module ActiveJob
|
|
|
85
85
|
"provider_job_id" => provider_job_id,
|
|
86
86
|
"queue_name" => queue_name,
|
|
87
87
|
"priority" => priority,
|
|
88
|
-
"arguments" =>
|
|
88
|
+
"arguments" => serialize_arguments_if_needed(arguments),
|
|
89
89
|
"executions" => executions,
|
|
90
90
|
"locale" => I18n.locale.to_s
|
|
91
91
|
}
|
|
@@ -128,19 +128,31 @@ module ActiveJob
|
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
private
|
|
131
|
+
def serialize_arguments_if_needed(arguments)
|
|
132
|
+
if arguments_serialized?
|
|
133
|
+
@serialized_arguments
|
|
134
|
+
else
|
|
135
|
+
serialize_arguments(arguments)
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
131
139
|
def deserialize_arguments_if_needed
|
|
132
|
-
if
|
|
140
|
+
if arguments_serialized?
|
|
133
141
|
@arguments = deserialize_arguments(@serialized_arguments)
|
|
134
142
|
@serialized_arguments = nil
|
|
135
143
|
end
|
|
136
144
|
end
|
|
137
145
|
|
|
138
|
-
def serialize_arguments(
|
|
139
|
-
Arguments.serialize(
|
|
146
|
+
def serialize_arguments(arguments)
|
|
147
|
+
Arguments.serialize(arguments)
|
|
140
148
|
end
|
|
141
149
|
|
|
142
150
|
def deserialize_arguments(serialized_args)
|
|
143
151
|
Arguments.deserialize(serialized_args)
|
|
144
152
|
end
|
|
153
|
+
|
|
154
|
+
def arguments_serialized?
|
|
155
|
+
defined?(@serialized_arguments) && @serialized_arguments
|
|
156
|
+
end
|
|
145
157
|
end
|
|
146
158
|
end
|
|
@@ -30,8 +30,8 @@ module ActiveJob
|
|
|
30
30
|
# class RemoteServiceJob < ActiveJob::Base
|
|
31
31
|
# retry_on CustomAppException # defaults to 3s wait, 5 attempts
|
|
32
32
|
# retry_on AnotherCustomAppException, wait: ->(executions) { executions * 2 }
|
|
33
|
-
# retry_on(YetAnotherCustomAppException) do |job,
|
|
34
|
-
# ExceptionNotifier.caught(
|
|
33
|
+
# retry_on(YetAnotherCustomAppException) do |job, error|
|
|
34
|
+
# ExceptionNotifier.caught(error)
|
|
35
35
|
# end
|
|
36
36
|
# retry_on ActiveRecord::Deadlocked, wait: 5.seconds, attempts: 3
|
|
37
37
|
# retry_on Net::OpenTimeout, wait: :exponentially_longer, attempts: 10
|
|
@@ -67,8 +67,8 @@ module ActiveJob
|
|
|
67
67
|
#
|
|
68
68
|
# class SearchIndexingJob < ActiveJob::Base
|
|
69
69
|
# discard_on ActiveJob::DeserializationError
|
|
70
|
-
# discard_on(CustomAppException) do |job,
|
|
71
|
-
# ExceptionNotifier.caught(
|
|
70
|
+
# discard_on(CustomAppException) do |job, error|
|
|
71
|
+
# ExceptionNotifier.caught(error)
|
|
72
72
|
# end
|
|
73
73
|
#
|
|
74
74
|
# def perform(record)
|
|
@@ -79,7 +79,7 @@ module ActiveJob
|
|
|
79
79
|
def discard_on(exception)
|
|
80
80
|
rescue_from exception do |error|
|
|
81
81
|
if block_given?
|
|
82
|
-
yield self,
|
|
82
|
+
yield self, error
|
|
83
83
|
else
|
|
84
84
|
logger.error "Discarded #{self.class} due to a #{exception}. The original exception was #{error.cause.inspect}."
|
|
85
85
|
end
|
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: 5.2.
|
|
4
|
+
version: 5.2.1.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: 2018-
|
|
11
|
+
date: 2018-07-30 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: 5.2.
|
|
19
|
+
version: 5.2.1.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: 5.2.
|
|
26
|
+
version: 5.2.1.rc1
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: globalid
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -86,8 +86,8 @@ homepage: http://rubyonrails.org
|
|
|
86
86
|
licenses:
|
|
87
87
|
- MIT
|
|
88
88
|
metadata:
|
|
89
|
-
source_code_uri: https://github.com/rails/rails/tree/v5.2.
|
|
90
|
-
changelog_uri: https://github.com/rails/rails/blob/v5.2.
|
|
89
|
+
source_code_uri: https://github.com/rails/rails/tree/v5.2.1.rc1/activejob
|
|
90
|
+
changelog_uri: https://github.com/rails/rails/blob/v5.2.1.rc1/activejob/CHANGELOG.md
|
|
91
91
|
post_install_message:
|
|
92
92
|
rdoc_options: []
|
|
93
93
|
require_paths:
|
|
@@ -99,12 +99,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
99
99
|
version: 2.2.2
|
|
100
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
requirements:
|
|
102
|
-
- - "
|
|
102
|
+
- - ">"
|
|
103
103
|
- !ruby/object:Gem::Version
|
|
104
|
-
version:
|
|
104
|
+
version: 1.3.1
|
|
105
105
|
requirements: []
|
|
106
106
|
rubyforge_project:
|
|
107
|
-
rubygems_version: 2.7.
|
|
107
|
+
rubygems_version: 2.7.3
|
|
108
108
|
signing_key:
|
|
109
109
|
specification_version: 4
|
|
110
110
|
summary: Job framework with pluggable queues.
|