activejob 8.0.0.beta1 → 8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fbfb304817561be2dc9669fc234d56cfc38bc25f02134e41299642807b0c997
4
- data.tar.gz: 791c6aa25026dab8c5c42ce200e843d9e898e8e67fcf8feda11cda9a98c2ad72
3
+ metadata.gz: b057adb9e0f95a232c9e5f47426c2555738637e6ea540fa1e5ac420f16e3fcae
4
+ data.tar.gz: 0cfdb021f58ad66972c0399325444bca333d94cf1b41077052285ff1bb2b702a
5
5
  SHA512:
6
- metadata.gz: 996122b64c9ae05031fea17c63835e42e2b9b97c7918be29676d148c276c9459701d65654111a1d3921b6bc17a2afbe167e87f5cfe6a51eaf3e278bbd94e707f
7
- data.tar.gz: 499c6a3257207aa90f824edbe5631767c5252d13b063860c00d06bd2440161960c692aeb596df83a3d29609be3a9e1c7c61ebcc881b94fc5983733884d2feb23
6
+ metadata.gz: e5ccec22443249143387d8186b10065f403d4410bc042621b31aa128093ab34625a42c4f071e8752be0e6fb856258a490f3b855cb2a46a0edc187a4ae93a4745
7
+ data.tar.gz: 80192a27f0d1f8234686f2f1b8fbcc0e7bef144e38425d836958a38f3c00601dd4343bed0ef2edf82c21e0f215f1764452a651fbdd7100edb275aaeaa06a3c33
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## Rails 8.0.0.rc1 (October 19, 2024) ##
2
+
3
+ * Remove deprecated `config.active_job.use_big_decimal_serializer`.
4
+
5
+ *Rafael Mendonça França*
6
+
7
+
1
8
  ## Rails 8.0.0.beta1 (September 26, 2024) ##
2
9
 
3
10
  * 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 # :default
13
- queue_adapter.enqueue_after_transaction_commit?
28
+ else
29
+ enqueue_after_transaction_commit
14
30
  end
15
31
 
16
32
  if after_transaction
@@ -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
- # - `:always` forces the job to be deferred.
52
- # - `:never` forces the job to be queued immediately.
53
- # - `:default` lets the queue adapter define the behavior (recommended).
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.
@@ -10,7 +10,7 @@ module ActiveJob
10
10
  MAJOR = 8
11
11
  MINOR = 0
12
12
  TINY = 0
13
- PRE = "beta1"
13
+ PRE = "rc1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -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 :enqueue_retry, :error
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
- if Thread.respond_to?(:each_caller_location)
200
- def enqueue_source_location
201
- Thread.each_caller_location do |location|
202
- frame = backtrace_cleaner.clean_frame(location)
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, :enqueue_after_transaction_commit)
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 ||= []
@@ -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::Base.enqueue_after_transaction_commit = app.config.active_job.delete(:enqueue_after_transaction_commit)
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|
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "set"
4
-
5
3
  module ActiveJob
6
4
  # = Active Job \Serializers
7
5
  #
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.beta1
4
+ version: 8.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: 2024-09-26 00:00:00.000000000 Z
11
+ date: 2024-10-19 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.beta1
19
+ version: 8.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: 8.0.0.beta1
26
+ version: 8.0.0.rc1
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.beta1/activejob/CHANGELOG.md
108
- documentation_uri: https://api.rubyonrails.org/v8.0.0.beta1/
107
+ changelog_uri: https://github.com/rails/rails/blob/v8.0.0.rc1/activejob/CHANGELOG.md
108
+ documentation_uri: https://api.rubyonrails.org/v8.0.0.rc1/
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.beta1/activejob
110
+ source_code_uri: https://github.com/rails/rails/tree/v8.0.0.rc1/activejob
111
111
  rubygems_mfa_required: 'true'
112
112
  post_install_message:
113
113
  rdoc_options: []