good_job 4.24.0 → 4.24.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 +4 -4
- data/CHANGELOG.md +50 -0
- data/README.md +5 -1
- data/app/charts/good_job/performance_index_chart.rb +1 -1
- data/app/charts/good_job/scheduled_by_queue_chart.rb +1 -1
- data/app/controllers/good_job/metrics_controller.rb +3 -1
- data/app/frontend/good_job/modules/theme_controller.js +42 -28
- data/app/models/good_job/batch.rb +1 -0
- data/app/models/good_job/i18n_config.rb +10 -0
- data/app/models/good_job/job.rb +37 -31
- data/app/views/good_job/shared/_navbar.erb +10 -24
- data/app/views/layouts/good_job/application.html.erb +1 -1
- data/config/brakeman.ignore +3 -3
- data/config/locales/az.yml +2 -4
- data/config/locales/de.yml +2 -4
- data/config/locales/en.yml +2 -4
- data/config/locales/es.yml +2 -4
- data/config/locales/fr.yml +4 -6
- data/config/locales/it.yml +2 -4
- data/config/locales/ja.yml +2 -4
- data/config/locales/ko.yml +2 -4
- data/config/locales/nl.yml +2 -4
- data/config/locales/pt-BR.yml +2 -4
- data/config/locales/ru.yml +2 -4
- data/config/locales/tr.yml +2 -4
- data/config/locales/uk.yml +2 -4
- data/config/locales/zh-CN.yml +2 -4
- data/lib/good_job/active_job_extensions/batches.rb +5 -1
- data/lib/good_job/active_job_extensions/interrupt_errors.rb +3 -2
- data/lib/good_job/bulk.rb +1 -0
- data/lib/good_job/configuration.rb +14 -0
- data/lib/good_job/engine.rb +2 -0
- data/lib/good_job/log_subscriber.rb +9 -0
- data/lib/good_job/version.rb +1 -1
- metadata +495 -459
|
@@ -13,7 +13,11 @@ module GoodJob
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def batch
|
|
16
|
-
|
|
16
|
+
current_job = CurrentThread.job
|
|
17
|
+
return @_batch unless current_job && current_job.active_job_id == job_id
|
|
18
|
+
|
|
19
|
+
@_batch = nil if @_batch&.id != current_job.batch_id
|
|
20
|
+
@_batch ||= current_job.reload_batch&.to_batch
|
|
17
21
|
end
|
|
18
22
|
alias batch? batch
|
|
19
23
|
end
|
|
@@ -7,8 +7,9 @@ module GoodJob
|
|
|
7
7
|
extend ActiveSupport::Concern
|
|
8
8
|
|
|
9
9
|
included do
|
|
10
|
-
around_perform do |
|
|
11
|
-
|
|
10
|
+
around_perform do |job, block|
|
|
11
|
+
interrupted_at = CurrentThread.execution_interrupted
|
|
12
|
+
raise InterruptError, "Interrupted after starting perform at '#{interrupted_at}'" if interrupted_at.present? && CurrentThread.active_job_id == job.job_id
|
|
12
13
|
|
|
13
14
|
block.call
|
|
14
15
|
end
|
data/lib/good_job/bulk.rb
CHANGED
|
@@ -97,6 +97,7 @@ module GoodJob
|
|
|
97
97
|
job.respond_to?(:good_job_enqueue_concurrency_controlled?) && job.good_job_enqueue_concurrency_controlled?
|
|
98
98
|
end
|
|
99
99
|
adapter.enqueue_all(bulkable_jobs) if bulkable_jobs.any?
|
|
100
|
+
ActiveSupport::Notifications.instrument("enqueue_jobs_individually.good_job", { jobs: unbulkable_jobs }) if unbulkable_jobs.any?
|
|
100
101
|
else
|
|
101
102
|
unbulkable_jobs = jobs
|
|
102
103
|
end
|
|
@@ -541,6 +541,20 @@ module GoodJob
|
|
|
541
541
|
(options[:dequeue_query_sort] || rails_config[:dequeue_query_sort] || :created_at).to_sym
|
|
542
542
|
end
|
|
543
543
|
|
|
544
|
+
# Emits a deprecation warning when +dequeue_query_sort+ has not been
|
|
545
|
+
# explicitly configured, because the default will change from +:created_at+
|
|
546
|
+
# to +:scheduled_at+ (and the option will be removed) in the next major version.
|
|
547
|
+
# @return [void]
|
|
548
|
+
def warn_dequeue_query_sort_default
|
|
549
|
+
return unless options[:dequeue_query_sort].nil? && rails_config[:dequeue_query_sort].nil?
|
|
550
|
+
|
|
551
|
+
GoodJob.deprecator.warn(<<~MSG.squish)
|
|
552
|
+
GoodJob will dequeue jobs ordered by `scheduled_at` instead of `created_at` in the next major version,
|
|
553
|
+
and the `dequeue_query_sort` option will be removed. Opt in to the new behavior now and silence this
|
|
554
|
+
warning by setting `config.good_job.dequeue_query_sort = :scheduled_at`.
|
|
555
|
+
MSG
|
|
556
|
+
end
|
|
557
|
+
|
|
544
558
|
# Resolves lazily memoized values so the configuration can be frozen.
|
|
545
559
|
# @return [self]
|
|
546
560
|
def prepare_for_sharing
|
data/lib/good_job/engine.rb
CHANGED
|
@@ -48,6 +48,8 @@ module GoodJob
|
|
|
48
48
|
GoodJob.on_thread_error = rails_config[:on_thread_error] if rails_config.key?(:on_thread_error)
|
|
49
49
|
GoodJob.preserve_job_records = rails_config[:preserve_job_records] if rails_config.key?(:preserve_job_records)
|
|
50
50
|
GoodJob.retry_on_unhandled_error = rails_config[:retry_on_unhandled_error] if rails_config.key?(:retry_on_unhandled_error)
|
|
51
|
+
|
|
52
|
+
GoodJob.configuration.warn_dequeue_query_sort_default
|
|
51
53
|
end
|
|
52
54
|
end
|
|
53
55
|
|
|
@@ -254,6 +254,15 @@ module GoodJob
|
|
|
254
254
|
end
|
|
255
255
|
end
|
|
256
256
|
|
|
257
|
+
# @!macro notification_responder
|
|
258
|
+
def enqueue_jobs_individually(event)
|
|
259
|
+
jobs = event.payload[:jobs]
|
|
260
|
+
|
|
261
|
+
info do
|
|
262
|
+
"Enqueuing #{jobs.size} #{'job'.pluralize(jobs.size)} with enqueue concurrency limits individually instead of in bulk: #{jobs.map { |job| job.class.name }.uniq.join(', ')}"
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
|
|
257
266
|
# @!macro notification_responder
|
|
258
267
|
def systemd_watchdog_start(event)
|
|
259
268
|
interval = event.payload[:interval]
|