good_job 4.11.2 → 4.12.0

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: 5de7dadf0496603de0b1b38fbb1df12745078c8cb529f615f2495c6ff926caca
4
- data.tar.gz: 94a0e727f0523e64ceb63cec668cd532c25e55cb0257a2f5c4328762aacef6cd
3
+ metadata.gz: f8d2230721300457a34764edf4b7b05a7c2e1e58931186a594b505f13c3a35f0
4
+ data.tar.gz: 9330aa1ed9b6fea281bbe9cf95c6a46d96f6eb670b12041d113fb56c89228d87
5
5
  SHA512:
6
- metadata.gz: 44614cb9f776531726c775baf89e8433306c4cad9f477099fb4c752ef6ba6e9504e8001f95ec37db1ce366925da183a530d7c3ba259b070d4b24a6a617379d30
7
- data.tar.gz: d4eac5bbaf7b13f7431fdeb550f4390215df86cd02cb063da24aaab058e5e70dda336aa5543cd71bb20690292d7da8a6ccf5a24c438dbb30b5b99e353fbbe01f
6
+ metadata.gz: a545269af550ef4a99d353d2fa0f08c60c002651682dc58b831a85a63aff0703506c19047230d09572de99810c4754e184ec2fcb852429f84330fdde70e855ba
7
+ data.tar.gz: cc75f90006b8e24237759f5648ff78a3799c5a67b055df61c73dcc1f71f2cc7b40e3a60f7898f7688609ec677587fe7fd11762a7dbcaa3af75d33319e8f08c58
data/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## [v4.12.0](https://github.com/bensheldon/good_job/tree/v4.12.0) (2025-09-22)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v4.11.2...v4.12.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Allow `GoodJob::Cli.log_to_stdout =` to be set by the parent application [\#1680](https://github.com/bensheldon/good_job/pull/1680) ([bensheldon](https://github.com/bensheldon))
10
+ - Optimize job\_class scope performance by using column instead of JSON extraction [\#1672](https://github.com/bensheldon/good_job/pull/1672) ([ScotterC](https://github.com/ScotterC))
11
+ - Add state column to cron entries table [\#1652](https://github.com/bensheldon/good_job/pull/1652) ([gregplumbly](https://github.com/gregplumbly))
12
+
13
+ **Fixed bugs:**
14
+
15
+ - Reorganize Dashboard header, ensure favicon svg is encoded; fix double mt-auto [\#1668](https://github.com/bensheldon/good_job/pull/1668) ([bensheldon](https://github.com/bensheldon))
16
+
17
+ **Closed issues:**
18
+
19
+ - GoodJob Cron unique index [\#1678](https://github.com/bensheldon/good_job/issues/1678)
20
+ - params\_job\_class JSON extraction causing performance issues - why not use job\_class column? [\#1671](https://github.com/bensheldon/good_job/issues/1671)
21
+ - Good Job process stalling and CPU at 100% [\#1669](https://github.com/bensheldon/good_job/issues/1669)
22
+
23
+ **Merged pull requests:**
24
+
25
+ - Update sorbet/tapioca [\#1681](https://github.com/bensheldon/good_job/pull/1681) ([bensheldon](https://github.com/bensheldon))
26
+ - Remove obsolete property from tests [\#1676](https://github.com/bensheldon/good_job/pull/1676) ([RDIL](https://github.com/RDIL))
27
+ - Bump actions/checkout from 4 to 5 [\#1673](https://github.com/bensheldon/good_job/pull/1673) ([dependabot[bot]](https://github.com/apps/dependabot))
28
+
3
29
  ## [v4.11.2](https://github.com/bensheldon/good_job/tree/v4.11.2) (2025-08-06)
4
30
 
5
31
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v4.11.1...v4.11.2)
@@ -1024,7 +1050,7 @@
1024
1050
 
1025
1051
  **Fixed bugs:**
1026
1052
 
1027
- - Skip `RecordAlreadyAdvisoryLockedError` during mass-update action [\#1158](https://github.com/bensheldon/good_job/pull/1158) ([jmarsh24](https://github.com/jmarsh24))
1053
+ - Skip `RecordAlreadyAdvisoryLockedError` during mass-update action [\#1158](https://github.com/bensheldon/good_job/pull/1158) ([justinallenmarsh](https://github.com/justinallenmarsh))
1028
1054
 
1029
1055
  **Closed issues:**
1030
1056
 
@@ -239,7 +239,7 @@ module GoodJob
239
239
  end
240
240
 
241
241
  def params_job_class
242
- json_string(arel_table['serialized_params'], 'job_class')
242
+ arel_table[:job_class]
243
243
  end
244
244
 
245
245
  def params_execution_count
@@ -250,8 +250,8 @@ module GoodJob
250
250
  )
251
251
  end
252
252
 
253
- def concurrency_key_created_at_index_migrated?
254
- return true if connection.index_name_exists?(:good_jobs, :index_good_jobs_on_concurrency_key_and_created_at)
253
+ def job_class_index_migrated?
254
+ return true if connection.index_name_exists?(:good_jobs, :index_good_jobs_on_job_class)
255
255
 
256
256
  migration_pending_warning!
257
257
  false
@@ -6,12 +6,13 @@
6
6
  <div class="list-group list-group-flush text-nowrap" role="table">
7
7
  <header class="list-group-item body-secondary">
8
8
  <div class="row small text-muted text-uppercase align-items-center">
9
- <div class="col-12 col-lg-2"></div>
10
- <div class="col-6 col-lg-2 d-none d-lg-block"><%= t "good_job.models.cron.class" %></div>
11
- <div class="col-6 col-lg-2 d-none d-lg-block"><%= t "good_job.models.cron.schedule" %></div>
12
- <div class="col-6 col-lg-2 d-none d-lg-block"><%= t "good_job.models.cron.next_scheduled" %></div>
13
- <div class="col-6 col-lg-2 d-none d-lg-block"><%= t "good_job.models.cron.last_run" %></div>
14
- <div class="col text-end">
9
+ <div class="col-lg-2"></div>
10
+ <div class="col-lg-2 d-none d-lg-block"><%= t "good_job.models.cron.class" %></div>
11
+ <div class="col-lg-2 d-none d-lg-block"><%= t "good_job.models.cron.schedule" %></div>
12
+ <div class="col-lg-2 d-none d-lg-block"><%= t "good_job.models.cron.next_scheduled" %></div>
13
+ <div class="col-lg-1 d-none d-lg-block"><%= t "good_job.models.cron.last_run" %></div>
14
+ <div class="col-lg-1 d-none d-lg-block"><%= t "good_job.models.cron.status" %></div>
15
+ <div class="col-lg-2 text-end">
15
16
  <%= tag.button type: "button", class: "btn btn-sm text-muted", role: "button",
16
17
  data: { bs_toggle: "collapse", bs_target: ".cron-entry-properties" },
17
18
  aria: { expanded: false, controls: @cron_entries.map { |cron_entry| "##{dom_id(cron_entry, 'properties')}" }.join(" ") } do %>
@@ -37,13 +38,21 @@
37
38
  <div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.cron.next_scheduled" %></div>
38
39
  <%= relative_time cron_entry.next_at %>
39
40
  </div>
40
- <div class="col-6 col-lg-2 text-wrap small">
41
+ <div class="col-6 col-lg-1 text-wrap small">
41
42
  <% if cron_entry.last_job.present? %>
42
43
  <div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.cron.last_run" %></div>
43
44
  <%= link_to relative_time(cron_entry.last_job_at), cron_entry_path(cron_entry), title: "Job #{cron_entry.last_job.id}" %>
44
45
  <% end %>
45
46
  </div>
46
- <div class="col d-flex gap-3 justify-content-end">
47
+ <div class="col-6 col-lg-1 text-wrap small">
48
+ <div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.cron.status" %></div>
49
+ <% if cron_entry.enabled? %>
50
+ <span class="text-success"><%= t "good_job.models.cron.states.active" %></span>
51
+ <% else %>
52
+ <span class="text-muted"><%= t "good_job.models.cron.states.paused" %></span>
53
+ <% end %>
54
+ </div>
55
+ <div class="col-lg-2 d-flex gap-3 justify-content-end">
47
56
  <%= button_to enqueue_cron_entry_path(cron_entry), method: :post, class: "btn btn-sm btn-outline-primary", form_class: "d-inline-block", aria: { label: t("good_job.cron_entries.actions.enqueue") }, title: t("good_job.cron_entries.actions.enqueue"), data: { confirm: t("good_job.cron_entries.actions.confirm_enqueue") } do %>
48
57
  <%= render_icon "skip_forward" %>
49
58
  <% end %>
@@ -1,4 +1,4 @@
1
- <nav class="navbar p-1 shadow-sm mt-auto border-bottom text-muted small" id="secondary-navbar" data-live-poll-region="secondary-navbar">
1
+ <nav class="navbar p-1 shadow-sm border-bottom text-muted small" id="secondary-navbar" data-live-poll-region="secondary-navbar">
2
2
  <div class="container-fluid">
3
3
  <div class="flex-fill d-none d-sm-block ">
4
4
  <%= t(".inspiration") %>
@@ -1,25 +1,21 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="<%= I18n.locale %>" data-bs-theme="auto">
3
3
  <head>
4
- <title>Good Job Dashboard</title>
5
4
  <meta charset="utf-8">
6
5
  <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
7
- <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%2210 0 100 100%22><text y=%22.90em%22 font-size=%2290%22>👍</text></svg>">
8
- <%= csrf_meta_tags %>
9
- <%= csp_meta_tag %>
10
6
 
11
7
  <%# Bootstrap Color Modes
12
8
  "It is suggested to include the JavaScript at the top of your page
13
9
  to reduce potential screen flickering during reloading of your site."
14
10
  https://getbootstrap.com/docs/5.3/customize/color-modes/#javascript
15
11
  %>
16
- <script nonce="<%= content_security_policy_nonce %>">
12
+ <script nonce="<%= content_security_policy_nonce %>">
17
13
  let theme = localStorage.getItem('good_job-theme');
18
14
  if (!["light", "dark"].includes(theme)) {
19
15
  theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
20
16
  }
21
17
  document.documentElement.setAttribute('data-bs-theme', theme);
22
- </script>
18
+ </script>
23
19
 
24
20
  <%# Do not use asset tag helpers to avoid paths being overriden by config.asset_host %>
25
21
  <%= tag.link rel: "stylesheet", href: frontend_static_path(:bootstrap, format: :css, locale: nil), nonce: content_security_policy_nonce %>
@@ -31,6 +27,11 @@
31
27
  <% importmaps = GoodJob::FrontendsController.js_modules.keys.index_with { |module_name| frontend_module_path(module_name, format: :js, locale: nil) } %>
32
28
  <%= tag.script({ imports: importmaps }.to_json.html_safe, type: "importmap", nonce: content_security_policy_nonce) %>
33
29
  <%= tag.script "", type: "module", nonce: content_security_policy_nonce do %> import "application"; <% end %>
30
+
31
+ <title>Good Job Dashboard</title>
32
+ <%= tag.link rel: "icon", href: 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="10 0 100 100"><text y=".90em" font-size="90">👍</text></svg>' %>
33
+ <%= csrf_meta_tags %>
34
+ <%= csp_meta_tag %>
34
35
  </head>
35
36
  <body>
36
37
  <div class="d-flex flex-column min-vh-100">
@@ -191,6 +191,10 @@ de:
191
191
  last_run: Letzter Lauf
192
192
  next_scheduled: Als nächstes geplant
193
193
  schedule: Zeitplan
194
+ states:
195
+ active: Aktiv
196
+ paused: Pausiert
197
+ status: Status
194
198
  job:
195
199
  arguments: Argumente
196
200
  attempts: Versuche
@@ -191,6 +191,10 @@ en:
191
191
  last_run: Last run
192
192
  next_scheduled: Next scheduled
193
193
  schedule: Schedule
194
+ states:
195
+ active: Active
196
+ paused: Paused
197
+ status: Status
194
198
  job:
195
199
  arguments: Arguments
196
200
  attempts: Attempts
@@ -191,6 +191,10 @@ es:
191
191
  last_run: Última ejecución
192
192
  next_scheduled: Próxima ejecución
193
193
  schedule: Cronograma
194
+ states:
195
+ active: Activo
196
+ paused: Pausado
197
+ status: Estado
194
198
  job:
195
199
  arguments: Argumentos
196
200
  attempts: Intentos
@@ -191,6 +191,10 @@ fr:
191
191
  last_run: Dernière exécution
192
192
  next_scheduled: Prochaine exécution
193
193
  schedule: Planification
194
+ states:
195
+ active: Actif
196
+ paused: En pause
197
+ status: État
194
198
  job:
195
199
  arguments: Paramètres
196
200
  attempts: Tentatives
@@ -191,6 +191,10 @@ it:
191
191
  last_run: Ultima esecuzione
192
192
  next_scheduled: Prossima pianificazione
193
193
  schedule: Pianificazione
194
+ states:
195
+ active: Attivo
196
+ paused: In pausa
197
+ status: Stato
194
198
  job:
195
199
  arguments: Argomenti
196
200
  attempts: Tentativi
@@ -191,6 +191,10 @@ ja:
191
191
  last_run: 前回実行日時
192
192
  next_scheduled: 次回予定日時
193
193
  schedule: スケジュール
194
+ states:
195
+ active: アクティブ
196
+ paused: 一時停止
197
+ status: 状態
194
198
  job:
195
199
  arguments: 引数
196
200
  attempts: 試行回数
@@ -191,6 +191,10 @@ ko:
191
191
  last_run: 마지막 실행 일시
192
192
  next_scheduled: 다음 예정 일시
193
193
  schedule: 스케줄
194
+ states:
195
+ active: 활성
196
+ paused: 일시정지
197
+ status: 상태
194
198
  job:
195
199
  arguments: 인수
196
200
  attempts: 시도 횟수
@@ -191,6 +191,10 @@ nl:
191
191
  last_run: Laatste ronde
192
192
  next_scheduled: Volgende gepland
193
193
  schedule: Schema
194
+ states:
195
+ active: Actief
196
+ paused: Gepauzeerd
197
+ status: Status
194
198
  job:
195
199
  arguments: Argumenten
196
200
  attempts: Pogingen
@@ -191,6 +191,10 @@ pt-BR:
191
191
  last_run: Última execução
192
192
  next_scheduled: Próximo agendamento
193
193
  schedule: Agendamento
194
+ states:
195
+ active: Ativo
196
+ paused: Pausado
197
+ status: Estado
194
198
  job:
195
199
  arguments: Argumentos
196
200
  attempts: Tentativas
@@ -217,6 +217,10 @@ ru:
217
217
  last_run: Последний запуск
218
218
  next_scheduled: Следующий по расписанию
219
219
  schedule: Расписание
220
+ states:
221
+ active: Активно
222
+ paused: Приостановлено
223
+ status: Состояние
220
224
  job:
221
225
  arguments: Параметры
222
226
  attempts: Попытки
@@ -191,6 +191,10 @@ tr:
191
191
  last_run: Son çalıştırma
192
192
  next_scheduled: Sonraki planlama
193
193
  schedule: Program
194
+ states:
195
+ active: Aktif
196
+ paused: Duraklatıldı
197
+ status: Durum
194
198
  job:
195
199
  arguments: Argümanlar
196
200
  attempts: Denemeler
@@ -217,6 +217,10 @@ uk:
217
217
  last_run: Останній запуск
218
218
  next_scheduled: Наступне заплановане
219
219
  schedule: Розклад
220
+ states:
221
+ active: Активний
222
+ paused: Призупинено
223
+ status: Стан
220
224
  job:
221
225
  arguments: Аргументи
222
226
  attempts: Спроби
data/exe/good_job CHANGED
@@ -4,5 +4,4 @@
4
4
  require 'good_job/cli'
5
5
 
6
6
  GoodJob::CLI.within_exe = true
7
- GoodJob::CLI.log_to_stdout = true
8
7
  GoodJob::CLI.start(ARGV)
@@ -92,6 +92,7 @@ class CreateGoodJobs < ActiveRecord::Migration<%= migration_version %>
92
92
  where: "finished_at IS NULL", name: :index_good_job_jobs_for_candidate_lookup
93
93
  add_index :good_jobs, [:batch_id], where: "batch_id IS NOT NULL"
94
94
  add_index :good_jobs, [:batch_callback_id], where: "batch_callback_id IS NOT NULL"
95
+ add_index :good_jobs, :job_class, name: :index_good_jobs_on_job_class
95
96
  add_index :good_jobs, :labels, using: :gin, where: "(labels IS NOT NULL)", name: :index_good_jobs_on_labels
96
97
 
97
98
  add_index :good_job_executions, [:active_job_id, :created_at], name: :index_good_job_executions_on_active_job_id_and_created_at
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddIndexGoodJobsJobClass < ActiveRecord::Migration<%= migration_version %>
4
+ disable_ddl_transaction!
5
+
6
+ def change
7
+ reversible do |dir|
8
+ dir.up do
9
+ # Ensure this incremental update migration is idempotent
10
+ # with monolithic install migration.
11
+ return if connection.index_exists? :good_jobs, :job_class
12
+ end
13
+ end
14
+
15
+ add_index :good_jobs, :job_class, algorithm: :concurrently
16
+ end
17
+ end
data/lib/good_job/cli.rb CHANGED
@@ -29,10 +29,15 @@ module GoodJob
29
29
  attr_accessor :within_exe
30
30
  alias within_exe? within_exe
31
31
 
32
- # Whether to log to STDOUT
32
+ # Whether the CLI's default logger should log to STDOUT.
33
33
  # @return [Boolean, nil]
34
34
  attr_accessor :log_to_stdout
35
- alias log_to_stdout? log_to_stdout
35
+
36
+ # Whether the CLI's default logger logs to STDOUT.
37
+ # @return [Boolean, nil]
38
+ def log_to_stdout?
39
+ GoodJob::CLI.log_to_stdout.nil? ? GoodJob::CLI.within_exe? : GoodJob::CLI.log_to_stdout
40
+ end
36
41
 
37
42
  # @!visibility private
38
43
  def exit_on_failure?
@@ -2,7 +2,7 @@
2
2
 
3
3
  module GoodJob
4
4
  # GoodJob gem version.
5
- VERSION = '4.11.2'
5
+ VERSION = '4.12.0'
6
6
 
7
7
  # GoodJob version as Gem::Version object
8
8
  GEM_VERSION = Gem::Version.new(VERSION)
data/lib/good_job.rb CHANGED
@@ -290,7 +290,7 @@ module GoodJob
290
290
  # For use in tests/CI to validate GoodJob is up-to-date.
291
291
  # @return [Boolean]
292
292
  def self.migrated?
293
- GoodJob::Job.concurrency_key_created_at_index_migrated?
293
+ GoodJob::Job.job_class_index_migrated?
294
294
  end
295
295
 
296
296
  # Pause job execution for a given queue or job class.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: good_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.11.2
4
+ version: 4.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon
@@ -349,6 +349,7 @@ files:
349
349
  - lib/generators/good_job/templates/update/migrations/01_create_good_jobs.rb.erb
350
350
  - lib/generators/good_job/templates/update/migrations/02_add_jobs_finished_at_to_good_job_batches.rb.erb
351
351
  - lib/generators/good_job/templates/update/migrations/03_add_index_good_jobs_concurrency_key_created_at.rb.erb
352
+ - lib/generators/good_job/templates/update/migrations/04_add_index_good_jobs_job_class.rb.erb
352
353
  - lib/generators/good_job/update_generator.rb
353
354
  - lib/good_job.rb
354
355
  - lib/good_job/active_job_extensions/batches.rb
@@ -421,7 +422,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
421
422
  - !ruby/object:Gem::Version
422
423
  version: '0'
423
424
  requirements: []
424
- rubygems_version: 3.6.9
425
+ rubygems_version: 3.7.2
425
426
  specification_version: 4
426
427
  summary: A multithreaded, Postgres-based ActiveJob backend for Ruby on Rails
427
428
  test_files: []