activejob 8.0.0.beta1 → 8.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/lib/active_job/enqueue_after_transaction_commit.rb +18 -2
- data/lib/active_job/enqueuing.rb +3 -4
- data/lib/active_job/gem_version.rb +1 -1
- data/lib/active_job/log_subscriber.rb +6 -16
- data/lib/active_job/queue_adapters/abstract_adapter.rb +0 -8
- data/lib/active_job/queue_adapters/delayed_job_adapter.rb +0 -8
- data/lib/active_job/queue_adapters/inline_adapter.rb +0 -4
- data/lib/active_job/queue_adapters/queue_classic_adapter.rb +0 -8
- data/lib/active_job/queue_adapters/test_adapter.rb +1 -9
- data/lib/active_job/railtie.rb +18 -2
- data/lib/active_job/serializers.rb +0 -2
- data/lib/active_job.rb +0 -12
- 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: 71b6b7774f7430779cfbdb439fab92b52b7db4a88e32bf2a690f09bfd031e970
|
4
|
+
data.tar.gz: 6a689528359886554c2b7943c5de2f3af427e96df4c27637531c6af4806cc312
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adf5e9145ef40b655db84f84f7983d336c29621032d2bf423999659d687d251eac9f1b370c2771dd1c85c41bb93afa056a0a92b0e2b54683b42cf6e7fcc61360
|
7
|
+
data.tar.gz: 4e470b1631bb59e6c58200d21bdb383cf55294da7bf5d977564f8bf7366a465ba86e3ffe0720405fcbdebf8f3439869f8dc03f596bd044f93111c7de128f837a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## Rails 8.0.0.rc2 (October 30, 2024) ##
|
2
|
+
|
3
|
+
* No changes.
|
4
|
+
|
5
|
+
|
6
|
+
## Rails 8.0.0.rc1 (October 19, 2024) ##
|
7
|
+
|
8
|
+
* Remove deprecated `config.active_job.use_big_decimal_serializer`.
|
9
|
+
|
10
|
+
*Rafael Mendonça França*
|
11
|
+
|
12
|
+
|
1
13
|
## Rails 8.0.0.beta1 (September 26, 2024) ##
|
2
14
|
|
3
15
|
* Deprecate `sucker_punch` as an adapter option.
|
@@ -4,13 +4,29 @@ module ActiveJob
|
|
4
4
|
module EnqueueAfterTransactionCommit # :nodoc:
|
5
5
|
private
|
6
6
|
def raw_enqueue
|
7
|
+
enqueue_after_transaction_commit = self.class.enqueue_after_transaction_commit
|
8
|
+
|
7
9
|
after_transaction = case self.class.enqueue_after_transaction_commit
|
8
10
|
when :always
|
11
|
+
ActiveJob.deprecator.warn(<<~MSG.squish)
|
12
|
+
Setting `#{self.class.name}.enqueue_after_transaction_commit = :always` is deprecated and will be removed in Rails 8.1.
|
13
|
+
Set to `true` to always enqueue the job after the transaction is committed.
|
14
|
+
MSG
|
9
15
|
true
|
10
16
|
when :never
|
17
|
+
ActiveJob.deprecator.warn(<<~MSG.squish)
|
18
|
+
Setting `#{self.class.name}.enqueue_after_transaction_commit = :never` is deprecated and will be removed in Rails 8.1.
|
19
|
+
Set to `false` to never enqueue the job after the transaction is committed.
|
20
|
+
MSG
|
21
|
+
false
|
22
|
+
when :default
|
23
|
+
ActiveJob.deprecator.warn(<<~MSG.squish)
|
24
|
+
Setting `#{self.class.name}.enqueue_after_transaction_commit = :default` is deprecated and will be removed in Rails 8.1.
|
25
|
+
Set to `false` to never enqueue the job after the transaction is committed.
|
26
|
+
MSG
|
11
27
|
false
|
12
|
-
else
|
13
|
-
|
28
|
+
else
|
29
|
+
enqueue_after_transaction_commit
|
14
30
|
end
|
15
31
|
|
16
32
|
if after_transaction
|
data/lib/active_job/enqueuing.rb
CHANGED
@@ -48,10 +48,9 @@ module ActiveJob
|
|
48
48
|
# automatically defers the enqueue to after the transaction commits.
|
49
49
|
#
|
50
50
|
# It can be set on a per job basis:
|
51
|
-
# -
|
52
|
-
# -
|
53
|
-
|
54
|
-
class_attribute :enqueue_after_transaction_commit, instance_accessor: false, instance_predicate: false, default: :never
|
51
|
+
# - true forces the job to be deferred.
|
52
|
+
# - false forces the job to be queued immediately.
|
53
|
+
class_attribute :enqueue_after_transaction_commit, instance_accessor: false, instance_predicate: false, default: false
|
55
54
|
end
|
56
55
|
|
57
56
|
# Includes the +perform_later+ method for job initialization.
|
@@ -125,7 +125,7 @@ module ActiveJob
|
|
125
125
|
"Stopped retrying #{job.class} (Job ID: #{job.job_id}) due to a #{ex.class} (#{ex.message}), which reoccurred on #{job.executions} attempts."
|
126
126
|
end
|
127
127
|
end
|
128
|
-
subscribe_log_level :
|
128
|
+
subscribe_log_level :retry_stopped, :error
|
129
129
|
|
130
130
|
def discard(event)
|
131
131
|
job = event.payload[:job]
|
@@ -196,22 +196,12 @@ module ActiveJob
|
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
return frame if frame
|
204
|
-
end
|
205
|
-
nil
|
206
|
-
end
|
207
|
-
else
|
208
|
-
def enqueue_source_location
|
209
|
-
caller_locations(2).each do |location|
|
210
|
-
frame = backtrace_cleaner.clean_frame(location)
|
211
|
-
return frame if frame
|
212
|
-
end
|
213
|
-
nil
|
199
|
+
def enqueue_source_location
|
200
|
+
Thread.each_caller_location do |location|
|
201
|
+
frame = backtrace_cleaner.clean_frame(location)
|
202
|
+
return frame if frame
|
214
203
|
end
|
204
|
+
nil
|
215
205
|
end
|
216
206
|
|
217
207
|
def enqueued_jobs_message(adapter, enqueued_jobs)
|
@@ -7,14 +7,6 @@ module ActiveJob
|
|
7
7
|
# Active Job supports multiple job queue systems. ActiveJob::QueueAdapters::AbstractAdapter
|
8
8
|
# forms the abstraction layer which makes this possible.
|
9
9
|
class AbstractAdapter
|
10
|
-
# Defines whether enqueuing should happen implicitly to after commit when called
|
11
|
-
# from inside a transaction. Most adapters should return true, but some adapters
|
12
|
-
# that use the same database as Active Record and are transaction aware can return
|
13
|
-
# false to continue enqueuing jobs as part of the transaction.
|
14
|
-
def enqueue_after_transaction_commit?
|
15
|
-
true
|
16
|
-
end
|
17
|
-
|
18
10
|
def enqueue(job)
|
19
11
|
raise NotImplementedError
|
20
12
|
end
|
@@ -16,14 +16,6 @@ module ActiveJob
|
|
16
16
|
#
|
17
17
|
# Rails.application.config.active_job.queue_adapter = :delayed_job
|
18
18
|
class DelayedJobAdapter < AbstractAdapter
|
19
|
-
def initialize(enqueue_after_transaction_commit: false)
|
20
|
-
@enqueue_after_transaction_commit = enqueue_after_transaction_commit
|
21
|
-
end
|
22
|
-
|
23
|
-
def enqueue_after_transaction_commit? # :nodoc:
|
24
|
-
@enqueue_after_transaction_commit
|
25
|
-
end
|
26
|
-
|
27
19
|
def enqueue(job) # :nodoc:
|
28
20
|
delayed_job = Delayed::Job.enqueue(JobWrapper.new(job.serialize), queue: job.queue_name, priority: job.priority)
|
29
21
|
job.provider_job_id = delayed_job.id
|
@@ -11,10 +11,6 @@ module ActiveJob
|
|
11
11
|
#
|
12
12
|
# Rails.application.config.active_job.queue_adapter = :inline
|
13
13
|
class InlineAdapter < AbstractAdapter
|
14
|
-
def enqueue_after_transaction_commit? # :nodoc:
|
15
|
-
false
|
16
|
-
end
|
17
|
-
|
18
14
|
def enqueue(job) # :nodoc:
|
19
15
|
Base.execute(job.serialize)
|
20
16
|
end
|
@@ -19,14 +19,6 @@ module ActiveJob
|
|
19
19
|
#
|
20
20
|
# Rails.application.config.active_job.queue_adapter = :queue_classic
|
21
21
|
class QueueClassicAdapter < AbstractAdapter
|
22
|
-
def initialize(enqueue_after_transaction_commit: false)
|
23
|
-
@enqueue_after_transaction_commit = enqueue_after_transaction_commit
|
24
|
-
end
|
25
|
-
|
26
|
-
def enqueue_after_transaction_commit? # :nodoc:
|
27
|
-
@enqueue_after_transaction_commit
|
28
|
-
end
|
29
|
-
|
30
22
|
def enqueue(job) # :nodoc:
|
31
23
|
qc_job = build_queue(job.queue_name).enqueue("#{JobWrapper.name}.perform", job.serialize)
|
32
24
|
job.provider_job_id = qc_job["id"] if qc_job.is_a?(Hash)
|
@@ -12,17 +12,9 @@ module ActiveJob
|
|
12
12
|
#
|
13
13
|
# Rails.application.config.active_job.queue_adapter = :test
|
14
14
|
class TestAdapter < AbstractAdapter
|
15
|
-
attr_accessor(:perform_enqueued_jobs, :perform_enqueued_at_jobs, :filter, :reject, :queue, :at
|
15
|
+
attr_accessor(:perform_enqueued_jobs, :perform_enqueued_at_jobs, :filter, :reject, :queue, :at)
|
16
16
|
attr_writer(:enqueued_jobs, :performed_jobs)
|
17
17
|
|
18
|
-
def initialize(enqueue_after_transaction_commit: true)
|
19
|
-
@enqueue_after_transaction_commit = enqueue_after_transaction_commit
|
20
|
-
end
|
21
|
-
|
22
|
-
def enqueue_after_transaction_commit? # :nodoc:
|
23
|
-
@enqueue_after_transaction_commit
|
24
|
-
end
|
25
|
-
|
26
18
|
# Provides a store of all the enqueued jobs with the TestAdapter so you can check them.
|
27
19
|
def enqueued_jobs
|
28
20
|
@enqueued_jobs ||= []
|
data/lib/active_job/railtie.rb
CHANGED
@@ -31,7 +31,22 @@ module ActiveJob
|
|
31
31
|
ActiveJob::Base.include EnqueueAfterTransactionCommit
|
32
32
|
|
33
33
|
if app.config.active_job.key?(:enqueue_after_transaction_commit)
|
34
|
-
ActiveJob
|
34
|
+
ActiveJob.deprecator.warn(<<~MSG.squish)
|
35
|
+
`config.active_job.enqueue_after_transaction_commit` is deprecated and will be removed in Rails 8.1.
|
36
|
+
This configuration can still be set on individual jobs using `self.enqueue_after_transaction_commit=`,
|
37
|
+
but due the nature of this behavior, it is not recommended to be set globally.
|
38
|
+
MSG
|
39
|
+
|
40
|
+
value = case app.config.active_job.enqueue_after_transaction_commit
|
41
|
+
when :always
|
42
|
+
true
|
43
|
+
when :never
|
44
|
+
false
|
45
|
+
else
|
46
|
+
false
|
47
|
+
end
|
48
|
+
|
49
|
+
ActiveJob::Base.enqueue_after_transaction_commit = value
|
35
50
|
end
|
36
51
|
end
|
37
52
|
end
|
@@ -54,7 +69,8 @@ module ActiveJob
|
|
54
69
|
# Configs used in other initializers
|
55
70
|
options = options.except(
|
56
71
|
:log_query_tags_around_perform,
|
57
|
-
:custom_serializers
|
72
|
+
:custom_serializers,
|
73
|
+
:enqueue_after_transaction_commit
|
58
74
|
)
|
59
75
|
|
60
76
|
options.each do |k, v|
|
data/lib/active_job.rb
CHANGED
@@ -49,18 +49,6 @@ module ActiveJob
|
|
49
49
|
autoload :TestCase
|
50
50
|
autoload :TestHelper
|
51
51
|
|
52
|
-
def self.use_big_decimal_serializer
|
53
|
-
ActiveJob.deprecator.warn <<-WARNING.squish
|
54
|
-
Rails.application.config.active_job.use_big_decimal_serializer is deprecated and will be removed in Rails 8.0.
|
55
|
-
WARNING
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.use_big_decimal_serializer=(value)
|
59
|
-
ActiveJob.deprecator.warn <<-WARNING.squish
|
60
|
-
Rails.application.config.active_job.use_big_decimal_serializer is deprecated and will be removed in Rails 8.0.
|
61
|
-
WARNING
|
62
|
-
end
|
63
|
-
|
64
52
|
##
|
65
53
|
# :singleton-method: verbose_enqueue_logs
|
66
54
|
#
|
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: 8.0.0.
|
4
|
+
version: 8.0.0.rc2
|
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: 2024-
|
11
|
+
date: 2024-10-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: 8.0.0.
|
19
|
+
version: 8.0.0.rc2
|
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: 8.0.0.
|
26
|
+
version: 8.0.0.rc2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: globalid
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,10 +104,10 @@ licenses:
|
|
104
104
|
- MIT
|
105
105
|
metadata:
|
106
106
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
107
|
-
changelog_uri: https://github.com/rails/rails/blob/v8.0.0.
|
108
|
-
documentation_uri: https://api.rubyonrails.org/v8.0.0.
|
107
|
+
changelog_uri: https://github.com/rails/rails/blob/v8.0.0.rc2/activejob/CHANGELOG.md
|
108
|
+
documentation_uri: https://api.rubyonrails.org/v8.0.0.rc2/
|
109
109
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
110
|
-
source_code_uri: https://github.com/rails/rails/tree/v8.0.0.
|
110
|
+
source_code_uri: https://github.com/rails/rails/tree/v8.0.0.rc2/activejob
|
111
111
|
rubygems_mfa_required: 'true'
|
112
112
|
post_install_message:
|
113
113
|
rdoc_options: []
|