activejob 7.2.3 → 8.0.0.beta1

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: 4f76db92910f325154aa9d955728c51e2707232f2db258198ef3128d3f07ad26
4
- data.tar.gz: 3c68ce1d7ff44d94a9c877923e8f82de2f747d1a889e57c2bed0bd4fc71a41d5
3
+ metadata.gz: 0fbfb304817561be2dc9669fc234d56cfc38bc25f02134e41299642807b0c997
4
+ data.tar.gz: 791c6aa25026dab8c5c42ce200e843d9e898e8e67fcf8feda11cda9a98c2ad72
5
5
  SHA512:
6
- metadata.gz: 8af4d3675c132bf94582a852445b7aca33b7fdd44bea30c17e6ac7823c12c5d8857e712dc7f487ce1f5ab2fec1445bd94b0556aad19af66ccf6c5190c7c9f3e8
7
- data.tar.gz: 3560f91b6101294422260c4dfa4106d6588fccd7aa7b8ef94eaa3fbbf17b5380001ed6667d0619a68a6258612193c1677dd5e7e3a1613f9d1ff21368562687e8
6
+ metadata.gz: 996122b64c9ae05031fea17c63835e42e2b9b97c7918be29676d148c276c9459701d65654111a1d3921b6bc17a2afbe167e87f5cfe6a51eaf3e278bbd94e707f
7
+ data.tar.gz: 499c6a3257207aa90f824edbe5631767c5252d13b063860c00d06bd2440161960c692aeb596df83a3d29609be3a9e1c7c61ebcc881b94fc5983733884d2feb23
data/CHANGELOG.md CHANGED
@@ -1,111 +1,13 @@
1
- ## Rails 7.2.3 (October 28, 2025) ##
1
+ ## Rails 8.0.0.beta1 (September 26, 2024) ##
2
2
 
3
- * Include the actual Active Job locale when serializing rather than I18n locale.
3
+ * Deprecate `sucker_punch` as an adapter option.
4
4
 
5
- *Adrien S*
5
+ If you're using this adapter, change to `adapter: async` for the same functionality.
6
6
 
7
- * Avoid crashing in Active Job logger when logging enqueueing errors
7
+ *Dino Maric, zzak*
8
8
 
9
- `ActiveJob.perform_all_later` could fail with a `TypeError` when all
10
- provided jobs failed to be enqueueed.
9
+ * Use `RAILS_MAX_THREADS` in `ActiveJob::AsyncAdapter`. If it is not set, use 5 as default.
11
10
 
12
- *Efstathios Stivaros*
11
+ *heka1024*
13
12
 
14
-
15
- ## Rails 7.2.2.2 (August 13, 2025) ##
16
-
17
- * No changes.
18
-
19
-
20
- ## Rails 7.2.2.1 (December 10, 2024) ##
21
-
22
- * No changes.
23
-
24
-
25
- ## Rails 7.2.2 (October 30, 2024) ##
26
-
27
- * No changes.
28
-
29
-
30
- ## Rails 7.2.1.2 (October 23, 2024) ##
31
-
32
- * No changes.
33
-
34
-
35
- ## Rails 7.2.1.1 (October 15, 2024) ##
36
-
37
- * No changes.
38
-
39
-
40
- ## Rails 7.2.1 (August 22, 2024) ##
41
-
42
- * No changes.
43
-
44
-
45
- ## Rails 7.2.0 (August 09, 2024) ##
46
-
47
- * All tests now respect the `active_job.queue_adapter` config.
48
-
49
- Previously if you had set `config.active_job.queue_adapter` in your `config/application.rb`
50
- or `config/environments/test.rb` file, the adapter you selected was previously not used consistently
51
- across all tests. In some tests your adapter would be used, but other tests would use the `TestAdapter`.
52
-
53
- In Rails 7.2, all tests will respect the `queue_adapter` config if provided. If no config is provided,
54
- the `TestAdapter` will continue to be used.
55
-
56
- See [#48585](https://github.com/rails/rails/pull/48585) for more details.
57
-
58
- *Alex Ghiculescu*
59
-
60
- * Make Active Job transaction aware when used conjointly with Active Record.
61
-
62
- A common mistake with Active Job is to enqueue jobs from inside a transaction,
63
- causing them to potentially be picked and ran by another process, before the
64
- transaction is committed, which may result in various errors.
65
-
66
- ```ruby
67
- Topic.transaction do
68
- topic = Topic.create(...)
69
- NewTopicNotificationJob.perform_later(topic)
70
- end
71
- ```
72
-
73
- Now Active Job will automatically defer the enqueuing to after the transaction is committed,
74
- and drop the job if the transaction is rolled back.
75
-
76
- Various queue implementations can choose to disable this behavior, and users can disable it,
77
- or force it on a per job basis:
78
-
79
- ```ruby
80
- class NewTopicNotificationJob < ApplicationJob
81
- self.enqueue_after_transaction_commit = :never # or `:always` or `:default`
82
- end
83
- ```
84
-
85
- *Jean Boussier*, *Cristian Bica*
86
-
87
- * Do not trigger immediate loading of `ActiveJob::Base` when loading `ActiveJob::TestHelper`.
88
-
89
- *Maxime Réty*
90
-
91
- * Preserve the serialized timezone when deserializing `ActiveSupport::TimeWithZone` arguments.
92
-
93
- *Joshua Young*
94
-
95
- * Remove deprecated `:exponentially_longer` value for the `:wait` in `retry_on`.
96
-
97
- *Rafael Mendonça França*
98
-
99
- * Remove deprecated support to set numeric values to `scheduled_at` attribute.
100
-
101
- *Rafael Mendonça França*
102
-
103
- * Deprecate `Rails.application.config.active_job.use_big_decimal_serializer`.
104
-
105
- *Rafael Mendonça França*
106
-
107
- * Remove deprecated primitive serializer for `BigDecimal` arguments.
108
-
109
- *Rafael Mendonça França*
110
-
111
- Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/activejob/CHANGELOG.md) for previous changes.
13
+ Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/activejob/CHANGELOG.md) for previous changes.
data/README.md CHANGED
@@ -126,6 +126,6 @@ Bug reports for the Ruby on \Rails project can be filed here:
126
126
 
127
127
  * https://github.com/rails/rails/issues
128
128
 
129
- Feature requests should be discussed on the rubyonrails-core forum here:
129
+ Feature requests should be discussed on the rails-core mailing list here:
130
130
 
131
131
  * https://discuss.rubyonrails.org/c/rubyonrails-core
@@ -40,7 +40,7 @@ module ActiveJob # :nodoc:
40
40
  # end
41
41
  #
42
42
  # Records that are passed in are serialized/deserialized using Global
43
- # ID. More information can be found in ActiveJob::Arguments.
43
+ # ID. More information can be found in Arguments.
44
44
  #
45
45
  # To enqueue a job to be performed as soon as the queuing system is free:
46
46
  #
@@ -50,7 +50,7 @@ module ActiveJob # :nodoc:
50
50
  #
51
51
  # ProcessPhotoJob.set(wait_until: Date.tomorrow.noon).perform_later(photo)
52
52
  #
53
- # More information can be found in ActiveJob::Core::ClassMethods#set.
53
+ # More information can be found in ActiveJob::Core::ClassMethods#set
54
54
  #
55
55
  # A job can also be processed immediately without sending to the queue:
56
56
  #
@@ -14,5 +14,9 @@ module ActiveJob
14
14
  def perform_later(...)
15
15
  @job_class.new(...).enqueue @options
16
16
  end
17
+
18
+ def perform_all_later(multi_args)
19
+ @job_class.perform_all_later(multi_args, options: @options)
20
+ end
17
21
  end
18
22
  end
@@ -114,7 +114,7 @@ module ActiveJob
114
114
  "arguments" => serialize_arguments_if_needed(arguments),
115
115
  "executions" => executions,
116
116
  "exception_executions" => exception_executions,
117
- "locale" => locale || I18n.locale.to_s,
117
+ "locale" => I18n.locale.to_s,
118
118
  "timezone" => timezone,
119
119
  "enqueued_at" => Time.now.utc.iso8601(9),
120
120
  "scheduled_at" => scheduled_at ? scheduled_at.utc.iso8601(9) : nil,
@@ -150,8 +150,7 @@ module ActiveJob
150
150
  # end
151
151
  def retry_job(options = {})
152
152
  instrument :enqueue_retry, options.slice(:error, :wait) do
153
- job = dup
154
- job.enqueue options
153
+ enqueue options
155
154
  end
156
155
  end
157
156
 
@@ -7,10 +7,10 @@ module ActiveJob
7
7
  end
8
8
 
9
9
  module VERSION
10
- MAJOR = 7
11
- MINOR = 2
12
- TINY = 3
13
- PRE = nil
10
+ MAJOR = 8
11
+ MINOR = 0
12
+ TINY = 0
13
+ PRE = "beta1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -50,7 +50,7 @@ module ActiveJob
50
50
  info do
51
51
  jobs = event.payload[:jobs]
52
52
  adapter = event.payload[:adapter]
53
- enqueued_count = event.payload[:enqueued_count].to_i
53
+ enqueued_count = event.payload[:enqueued_count]
54
54
 
55
55
  if enqueued_count == jobs.size
56
56
  enqueued_jobs_message(adapter, jobs)
@@ -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 :retry_stopped, :error
128
+ subscribe_log_level :enqueue_retry, :error
129
129
 
130
130
  def discard(event)
131
131
  job = event.payload[:job]
@@ -189,15 +189,29 @@ module ActiveJob
189
189
  end
190
190
 
191
191
  def log_enqueue_source
192
- source = extract_enqueue_source_location(caller)
192
+ source = enqueue_source_location
193
193
 
194
194
  if source
195
195
  logger.info("↳ #{source}")
196
196
  end
197
197
  end
198
198
 
199
- def extract_enqueue_source_location(locations)
200
- backtrace_cleaner.clean(locations.lazy).first
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
214
+ end
201
215
  end
202
216
 
203
217
  def enqueued_jobs_message(adapter, enqueued_jobs)
@@ -50,6 +50,7 @@ module ActiveJob
50
50
  case name_or_adapter
51
51
  when Symbol, String
52
52
  queue_adapter = ActiveJob::QueueAdapters.lookup(name_or_adapter).new
53
+ queue_adapter.try(:check_adapter)
53
54
  assign_adapter(name_or_adapter.to_s, queue_adapter)
54
55
  else
55
56
  if queue_adapter?(name_or_adapter)
@@ -74,7 +74,7 @@ module ActiveJob
74
74
  class Scheduler # :nodoc:
75
75
  DEFAULT_EXECUTOR_OPTIONS = {
76
76
  min_threads: 0,
77
- max_threads: Concurrent.processor_count,
77
+ max_threads: ENV.fetch("RAILS_MAX_THREADS", 5).to_i,
78
78
  auto_terminate: true,
79
79
  idletime: 60, # 1 minute
80
80
  max_queue: 0, # unlimited
@@ -18,6 +18,13 @@ module ActiveJob
18
18
  #
19
19
  # Rails.application.config.active_job.queue_adapter = :sucker_punch
20
20
  class SuckerPunchAdapter < AbstractAdapter
21
+ def check_adapter
22
+ ActiveJob.deprecator.warn <<~MSG.squish
23
+ The `sucker_punch` adapter is deprecated and will be removed in Rails 8.1.
24
+ Please use the `async` adapter instead.
25
+ MSG
26
+ end
27
+
21
28
  def enqueue(job) # :nodoc:
22
29
  if JobWrapper.respond_to?(:perform_async)
23
30
  # sucker_punch 2.0 API
@@ -12,7 +12,6 @@ module ActiveJob
12
12
  # * {Resque}[https://github.com/resque/resque]
13
13
  # * {Sidekiq}[https://sidekiq.org]
14
14
  # * {Sneakers}[https://github.com/jondot/sneakers]
15
- # * {Sucker Punch}[https://github.com/brandonhilkert/sucker_punch]
16
15
  # * Please Note: We are not accepting pull requests for new adapters. See the {README}[link:files/activejob/README_md.html] for more details.
17
16
  #
18
17
  # For testing and development Active Job has three built-in adapters:
@@ -32,7 +31,6 @@ module ActiveJob
32
31
  # | Resque | Yes | Yes | Yes (Gem) | Queue | Global | Yes |
33
32
  # | Sidekiq | Yes | Yes | Yes | Queue | No | Job |
34
33
  # | Sneakers | Yes | Yes | No | Queue | Queue | No |
35
- # | Sucker Punch | Yes | Yes | Yes | No | No | No |
36
34
  # | Active Job Async | Yes | Yes | Yes | No | No | No |
37
35
  # | Active Job Inline | No | Yes | N/A | N/A | N/A | N/A |
38
36
  # | Active Job Test | No | Yes | N/A | N/A | N/A | N/A |
@@ -119,7 +117,6 @@ module ActiveJob
119
117
  autoload :InlineAdapter
120
118
  autoload :BackburnerAdapter
121
119
  autoload :DelayedJobAdapter
122
- autoload :QueAdapter
123
120
  autoload :QueueClassicAdapter
124
121
  autoload :ResqueAdapter
125
122
  autoload :SidekiqAdapter
@@ -91,7 +91,9 @@ module ActiveJob
91
91
  app.config.active_record.query_log_tags |= [:job]
92
92
 
93
93
  ActiveSupport.on_load(:active_record) do
94
- ActiveRecord::QueryLogs.taggings[:job] = ->(context) { context[:job].class.name if context[:job] }
94
+ ActiveRecord::QueryLogs.taggings = ActiveRecord::QueryLogs.taggings.merge(
95
+ job: ->(context) { context[:job].class.name if context[:job] }
96
+ )
95
97
  end
96
98
  end
97
99
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activejob
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.3
4
+ version: 8.0.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2024-09-26 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: activesupport
@@ -15,14 +16,14 @@ dependencies:
15
16
  requirements:
16
17
  - - '='
17
18
  - !ruby/object:Gem::Version
18
- version: 7.2.3
19
+ version: 8.0.0.beta1
19
20
  type: :runtime
20
21
  prerelease: false
21
22
  version_requirements: !ruby/object:Gem::Requirement
22
23
  requirements:
23
24
  - - '='
24
25
  - !ruby/object:Gem::Version
25
- version: 7.2.3
26
+ version: 8.0.0.beta1
26
27
  - !ruby/object:Gem::Dependency
27
28
  name: globalid
28
29
  requirement: !ruby/object:Gem::Requirement
@@ -103,11 +104,12 @@ licenses:
103
104
  - MIT
104
105
  metadata:
105
106
  bug_tracker_uri: https://github.com/rails/rails/issues
106
- changelog_uri: https://github.com/rails/rails/blob/v7.2.3/activejob/CHANGELOG.md
107
- documentation_uri: https://api.rubyonrails.org/v7.2.3/
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/
108
109
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
109
- source_code_uri: https://github.com/rails/rails/tree/v7.2.3/activejob
110
+ source_code_uri: https://github.com/rails/rails/tree/v8.0.0.beta1/activejob
110
111
  rubygems_mfa_required: 'true'
112
+ post_install_message:
111
113
  rdoc_options: []
112
114
  require_paths:
113
115
  - lib
@@ -115,14 +117,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
117
  requirements:
116
118
  - - ">="
117
119
  - !ruby/object:Gem::Version
118
- version: 3.1.0
120
+ version: 3.2.0
119
121
  required_rubygems_version: !ruby/object:Gem::Requirement
120
122
  requirements:
121
123
  - - ">="
122
124
  - !ruby/object:Gem::Version
123
125
  version: '0'
124
126
  requirements: []
125
- rubygems_version: 3.6.9
127
+ rubygems_version: 3.5.16
128
+ signing_key:
126
129
  specification_version: 4
127
130
  summary: Job framework with pluggable queues.
128
131
  test_files: []