activejob 8.1.1 → 8.1.2

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: 6f45846e5ed801c5541e4b7907f449d4581dfa29a954b0fab1e79a987199a564
4
- data.tar.gz: 8cea650100951bb42741320d60d367ae49c67df1b0505c005ea4897af31cf21d
3
+ metadata.gz: b3a578cc3f9f7edc22dc86fba167b809a884264b4dd3a1191a9134f7b2620f84
4
+ data.tar.gz: 3d2f8faf8490ccaeb1b12f150b7c2f863b071451020ed79bbb4ae4dcd4f635e8
5
5
  SHA512:
6
- metadata.gz: e05c00958b8d5f6437cd5483e2e5619ec83175673d650bc2986751053aa933d3e912b158ccb87a1c01c41231d3d7980d473faa8e0d6085e59a930964ff062f7f
7
- data.tar.gz: 8f633a189ca68a61098f16ed89809de85338d30012c636f64797fc45ea39b28b0004ad1d9ea0b4d391d780db58c8904032c6d3bdbb20c6a7c70c3a3c5331e291
6
+ metadata.gz: 56ab511d1418ff2d13a4fe6fb19336899006ebc0f07f56c1bcc2de83bb27425974804fc63d95db64988638d0401455f28e183b537af19a8ed741fdb05253c584
7
+ data.tar.gz: ce679bda3a7b4ba95a12c0555a0334d4db859ccd57821468d49c148d6231165d7c100b5d6ae951cb02c9812f2ccc0a521eb7547217a1b2aefd6a77394c6f79d4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## Rails 8.1.2 (January 08, 2026) ##
2
+
3
+ * Fix `ActiveJob.perform_all_later` to respect `job_class.enqueue_after_transaction_commit`.
4
+
5
+ Previously, `perform_all_later` would enqueue all jobs immediately, even if
6
+ they had `enqueue_after_transaction_commit = true`. Now it correctly defers
7
+ jobs with this setting until after transaction commits, matching the behavior
8
+ of `perform_later`.
9
+
10
+ *OuYangJinTing*
11
+
12
+ * Fix using custom serializers with `ActiveJob::Arguments.serialize` when
13
+ `ActiveJob::Base` hasn't been loaded.
14
+
15
+ *Hartley McGuire*
16
+
1
17
  ## Rails 8.1.1 (October 28, 2025) ##
2
18
 
3
19
  * Only index new serializers.
@@ -50,7 +50,7 @@ module ActiveJob
50
50
  end
51
51
  end
52
52
  when Symbol
53
- { OBJECT_SERIALIZER_KEY => "ActiveJob::Serializers::SymbolSerializer", "value" => argument.name }
53
+ { Serializers::OBJECT_SERIALIZER_KEY => "ActiveJob::Serializers::SymbolSerializer", "value" => argument.name }
54
54
  when GlobalID::Identification
55
55
  convert_to_global_id_hash(argument)
56
56
  when Array
@@ -94,15 +94,13 @@ module ActiveJob
94
94
  RUBY2_KEYWORDS_KEY = "_aj_ruby2_keywords"
95
95
  # :nodoc:
96
96
  WITH_INDIFFERENT_ACCESS_KEY = "_aj_hash_with_indifferent_access"
97
- # :nodoc:
98
- OBJECT_SERIALIZER_KEY = "_aj_serialized"
99
97
 
100
98
  # :nodoc:
101
99
  RESERVED_KEYS = [
102
100
  GLOBALID_KEY, GLOBALID_KEY.to_sym,
103
101
  SYMBOL_KEYS_KEY, SYMBOL_KEYS_KEY.to_sym,
104
102
  RUBY2_KEYWORDS_KEY, RUBY2_KEYWORDS_KEY.to_sym,
105
- OBJECT_SERIALIZER_KEY, OBJECT_SERIALIZER_KEY.to_sym,
103
+ Serializers::OBJECT_SERIALIZER_KEY, Serializers::OBJECT_SERIALIZER_KEY.to_sym,
106
104
  WITH_INDIFFERENT_ACCESS_KEY, WITH_INDIFFERENT_ACCESS_KEY.to_sym,
107
105
  ].to_set
108
106
  private_constant :RESERVED_KEYS, :GLOBALID_KEY,
@@ -136,7 +134,7 @@ module ActiveJob
136
134
  end
137
135
 
138
136
  def custom_serialized?(hash)
139
- hash.key?(OBJECT_SERIALIZER_KEY)
137
+ hash.key?(Serializers::OBJECT_SERIALIZER_KEY)
140
138
  end
141
139
 
142
140
  def serialize_hash(argument)
@@ -197,4 +195,6 @@ module ActiveJob
197
195
  "without an id. (Maybe you forgot to call save?)"
198
196
  end
199
197
  end
198
+
199
+ ActiveSupport.run_load_hooks(:active_job_arguments, Arguments)
200
200
  end
@@ -2,6 +2,25 @@
2
2
 
3
3
  module ActiveJob
4
4
  module EnqueueAfterTransactionCommit # :nodoc:
5
+ class << self
6
+ def included(base)
7
+ ActiveJob.singleton_class.prepend(ActiveJobMethods)
8
+ end
9
+ end
10
+
11
+ module ActiveJobMethods
12
+ # Ensures perform_all_later respects each job's enqueue_after_transaction_commit configuration.
13
+ # Jobs with enqueue_after_transaction_commit set to true are deferred and enqueued only after the transaction commits;
14
+ # other jobs are enqueued immediately. This ensures enqueuing timing matches the per-job setting.
15
+ def perform_all_later(*jobs)
16
+ jobs.flatten!
17
+ deferred_jobs, immediate_jobs = jobs.partition { |job| job.class.enqueue_after_transaction_commit }
18
+ super(immediate_jobs) if immediate_jobs.any?
19
+ ActiveRecord.after_all_transactions_commit { super(deferred_jobs) } if deferred_jobs.any?
20
+ nil
21
+ end
22
+ end
23
+
5
24
  private
6
25
  def raw_enqueue
7
26
  if self.class.enqueue_after_transaction_commit
@@ -9,7 +9,7 @@ module ActiveJob
9
9
  module VERSION
10
10
  MAJOR = 8
11
11
  MINOR = 1
12
- TINY = 1
12
+ TINY = 2
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -121,7 +121,6 @@ module ActiveJob
121
121
  autoload :ResqueAdapter
122
122
  autoload :SidekiqAdapter
123
123
  autoload :SneakersAdapter
124
- autoload :SuckerPunchAdapter
125
124
  autoload :TestAdapter
126
125
 
127
126
  ADAPTER = "Adapter"
@@ -20,7 +20,7 @@ module ActiveJob
20
20
  end
21
21
 
22
22
  initializer "active_job.custom_serializers" do |app|
23
- ActiveSupport.on_load(:active_job) do
23
+ ActiveSupport.on_load(:active_job_arguments) do
24
24
  custom_serializers = app.config.active_job.custom_serializers
25
25
  ActiveJob::Serializers.add_serializers custom_serializers
26
26
  end
@@ -30,7 +30,7 @@ module ActiveJob
30
30
 
31
31
  def initialize
32
32
  super
33
- @template = { Arguments::OBJECT_SERIALIZER_KEY => self.class.name }.freeze
33
+ @template = { Serializers::OBJECT_SERIALIZER_KEY => self.class.name }.freeze
34
34
  end
35
35
 
36
36
  # Determines if an argument should be serialized by a serializer.
@@ -38,7 +38,7 @@ module ActiveJob
38
38
  # Will look up through all known serializers.
39
39
  # If no serializer found will raise <tt>ArgumentError</tt>.
40
40
  def deserialize(argument)
41
- serializer_name = argument[Arguments::OBJECT_SERIALIZER_KEY]
41
+ serializer_name = argument[OBJECT_SERIALIZER_KEY]
42
42
  raise ArgumentError, "Serializer name is not present in the argument: #{argument.inspect}" unless serializer_name
43
43
 
44
44
  serializer = serializer_name.safe_constantize
@@ -100,6 +100,9 @@ module ActiveJob
100
100
  end
101
101
  end
102
102
 
103
+ # :nodoc:
104
+ OBJECT_SERIALIZER_KEY = "_aj_serialized"
105
+
103
106
  add_serializers SymbolSerializer.instance,
104
107
  DurationSerializer.instance,
105
108
  DateTimeSerializer.instance,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activejob
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.1.1
4
+ version: 8.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 8.1.1
18
+ version: 8.1.2
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 8.1.1
25
+ version: 8.1.2
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: globalid
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -108,10 +108,10 @@ licenses:
108
108
  - MIT
109
109
  metadata:
110
110
  bug_tracker_uri: https://github.com/rails/rails/issues
111
- changelog_uri: https://github.com/rails/rails/blob/v8.1.1/activejob/CHANGELOG.md
112
- documentation_uri: https://api.rubyonrails.org/v8.1.1/
111
+ changelog_uri: https://github.com/rails/rails/blob/v8.1.2/activejob/CHANGELOG.md
112
+ documentation_uri: https://api.rubyonrails.org/v8.1.2/
113
113
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
114
- source_code_uri: https://github.com/rails/rails/tree/v8.1.1/activejob
114
+ source_code_uri: https://github.com/rails/rails/tree/v8.1.2/activejob
115
115
  rubygems_mfa_required: 'true'
116
116
  rdoc_options: []
117
117
  require_paths:
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  - !ruby/object:Gem::Version
128
128
  version: '0'
129
129
  requirements: []
130
- rubygems_version: 3.6.9
130
+ rubygems_version: 4.0.3
131
131
  specification_version: 4
132
132
  summary: Job framework with pluggable queues.
133
133
  test_files: []