good_job 4.11.1 → 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: c69e8c15dd5fb5a07db3dd7bba0c71d9a519dd493c81510cb5ff8ff2cc3aa511
4
- data.tar.gz: 7d6c2e2b36b732bdef7d1176f9c56c1f2846f9c8eb3f919af80c039cbf5b4fce
3
+ metadata.gz: f8d2230721300457a34764edf4b7b05a7c2e1e58931186a594b505f13c3a35f0
4
+ data.tar.gz: 9330aa1ed9b6fea281bbe9cf95c6a46d96f6eb670b12041d113fb56c89228d87
5
5
  SHA512:
6
- metadata.gz: 1a02075581a2d702880e99804db959c67d40d06d946a4392961d635c3b57c484c54755c2fe2cc024e9ca0eac5c9d40a164181dc515e07d6b48672553f907cf75
7
- data.tar.gz: 19db6c5195211f4fd0c1eda703d4cf6444ae4afcb4cb8b5388e44d9c0fa21ca5007c97c438b8821b8871a304842c4ad536ae8878eb4b29fdf585b08c78a983da
6
+ metadata.gz: a545269af550ef4a99d353d2fa0f08c60c002651682dc58b831a85a63aff0703506c19047230d09572de99810c4754e184ec2fcb852429f84330fdde70e855ba
7
+ data.tar.gz: cc75f90006b8e24237759f5648ff78a3799c5a67b055df61c73dcc1f71f2cc7b40e3a60f7898f7688609ec677587fe7fd11762a7dbcaa3af75d33319e8f08c58
data/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
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
+
29
+ ## [v4.11.2](https://github.com/bensheldon/good_job/tree/v4.11.2) (2025-08-06)
30
+
31
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v4.11.1...v4.11.2)
32
+
33
+ **Implemented enhancements:**
34
+
35
+ - Add a favicon [\#1664](https://github.com/bensheldon/good_job/pull/1664) ([itsalongstory](https://github.com/itsalongstory))
36
+
37
+ **Fixed bugs:**
38
+
39
+ - UI: Add `.text-wrap` to the Cron Entry key [\#1667](https://github.com/bensheldon/good_job/pull/1667) ([seanpdoyle](https://github.com/seanpdoyle))
40
+ - Fix duplicate parameters [\#1648](https://github.com/bensheldon/good_job/pull/1648) ([itsalongstory](https://github.com/itsalongstory))
41
+
42
+ **Closed issues:**
43
+
44
+ - проблема с вб [\#1665](https://github.com/bensheldon/good_job/issues/1665)
45
+
46
+ **Merged pull requests:**
47
+
48
+ - Docufix: correct connects\_to statement for multiple databases setup [\#1663](https://github.com/bensheldon/good_job/pull/1663) ([amo13](https://github.com/amo13))
49
+ - Update development dependencies and Rubocop [\#1662](https://github.com/bensheldon/good_job/pull/1662) ([bensheldon](https://github.com/bensheldon))
50
+ - Remove circular dependency of requiring good\_job in engine [\#1655](https://github.com/bensheldon/good_job/pull/1655) ([bensheldon](https://github.com/bensheldon))
51
+ - Render the current time according to the Rails application's time zone setting. [\#1650](https://github.com/bensheldon/good_job/pull/1650) ([itsalongstory](https://github.com/itsalongstory))
52
+ - Make the processes page more responsive by extracting queues and max\_threads [\#1647](https://github.com/bensheldon/good_job/pull/1647) ([luizkowalski](https://github.com/luizkowalski))
53
+
3
54
  ## [v4.11.1](https://github.com/bensheldon/good_job/tree/v4.11.1) (2025-06-30)
4
55
 
5
56
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v4.11.0...v4.11.1)
@@ -999,7 +1050,7 @@
999
1050
 
1000
1051
  **Fixed bugs:**
1001
1052
 
1002
- - 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))
1003
1054
 
1004
1055
  **Closed issues:**
1005
1056
 
data/README.md CHANGED
@@ -358,7 +358,7 @@ Good Job’s general behavior can also be configured via attributes directly on
358
358
  ```ruby
359
359
  # config/initializers/good_job.rb
360
360
  GoodJob.configure_active_record do
361
- connects_to database: :special_database
361
+ connects_to database: { writing: :special_database }
362
362
  self.table_name_prefix = "special_application_"
363
363
  end
364
364
  ```
@@ -97,7 +97,8 @@ module GoodJob
97
97
  def redirect_to_index
98
98
  # Redirect to the jobs page, maintaining query parameters. This is
99
99
  # necessary to support the `?poll=1` parameter that enables live polling.
100
- redirect_to jobs_path(request.query_parameters)
100
+ # But `locale` will be set by `default_url_options`.
101
+ redirect_to jobs_path(request.query_parameters.except("locale"))
101
102
  end
102
103
 
103
104
  private
@@ -30,7 +30,7 @@ module GoodJob
30
30
 
31
31
  def queues
32
32
  base_query.group(:queue_name).count
33
- .sort_by { |name, _count| name.to_s || EMPTY }
33
+ .sort_by { |name, _count| name.presence || EMPTY }
34
34
  .to_h
35
35
  end
36
36
 
@@ -67,14 +67,14 @@ module GoodJob
67
67
  on_discard.constantize.set(priority: callback_priority, queue: callback_queue_name).perform_later(to_batch, { event: :discard }) if on_discard.present?
68
68
  end
69
69
 
70
- if enqueued_at && !(self.class.jobs_finished_at_migrated? ? jobs_finished_at : finished_at) && jobs.where(finished_at: nil).count.zero?
70
+ if enqueued_at && !(self.class.jobs_finished_at_migrated? ? jobs_finished_at : finished_at) && jobs.where(finished_at: nil).none?
71
71
  self.class.jobs_finished_at_migrated? ? update(jobs_finished_at: Time.current) : update(finished_at: Time.current)
72
72
 
73
73
  on_success.constantize.set(priority: callback_priority, queue: callback_queue_name).perform_later(to_batch, { event: :success }) if !discarded_at && on_success.present?
74
74
  on_finish.constantize.set(priority: callback_priority, queue: callback_queue_name).perform_later(to_batch, { event: :finish }) if on_finish.present?
75
75
  end
76
76
 
77
- update(finished_at: Time.current) if !finished_at && self.class.jobs_finished_at_migrated? && jobs_finished? && callback_jobs.where(finished_at: nil).count.zero?
77
+ update(finished_at: Time.current) if !finished_at && self.class.jobs_finished_at_migrated? && jobs_finished? && callback_jobs.where(finished_at: nil).none?
78
78
  end
79
79
  end
80
80
  end
@@ -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
@@ -50,7 +50,7 @@ module GoodJob
50
50
  end
51
51
 
52
52
  def self.pause(queue: nil, job_class: nil, label: nil)
53
- raise ArgumentError, "Must provide exactly one of queue, job_class, or label" unless [queue, job_class, label].count(&:present?) == 1
53
+ raise ArgumentError, "Must provide exactly one of queue, job_class, or label" unless [queue, job_class, label].one?(&:present?)
54
54
 
55
55
  setting = find_or_initialize_by(key: PAUSES) do |record|
56
56
  record.value = { "queues" => [], "job_classes" => [], "labels" => [] }
@@ -70,7 +70,7 @@ module GoodJob
70
70
  end
71
71
 
72
72
  def self.unpause(queue: nil, job_class: nil, label: nil)
73
- raise ArgumentError, "Must provide exactly one of queue, job_class, or label" unless [queue, job_class, label].count(&:present?) == 1
73
+ raise ArgumentError, "Must provide exactly one of queue, job_class, or label" unless [queue, job_class, label].one?(&:present?)
74
74
 
75
75
  setting = find_by(key: PAUSES)
76
76
  return unless setting
@@ -92,7 +92,7 @@ module GoodJob
92
92
  end
93
93
 
94
94
  def self.paused?(queue: nil, job_class: nil, label: nil)
95
- raise ArgumentError, "Must provide at most one of queue, job_class, or label" if [queue, job_class, label].count(&:present?) > 1
95
+ raise ArgumentError, "Must provide at most one of queue, job_class, or label" if [queue, job_class, label].many?(&:present?)
96
96
 
97
97
  if queue
98
98
  queue.in? paused(:queues)
@@ -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 %>
@@ -25,7 +26,7 @@
25
26
  <div id="<%= dom_id(cron_entry) %>" class="list-group-item py-3" role="row">
26
27
  <div class="row align-items-center">
27
28
  <div class="col-12 col-lg-2">
28
- <div class="small font-monospace"><%= cron_entry.key %></div>
29
+ <div class="small font-monospace text-wrap"><%= cron_entry.key %></div>
29
30
  <div class="small text-muted text-wrap"><%= cron_entry.description %></div>
30
31
  </div>
31
32
  <div class="col-12 col-lg-2 text-wrap"><%= tag.span tag.code(cron_entry.job_class), class: "fs-5 mb-0" %></div>
@@ -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 %>
@@ -3,7 +3,7 @@
3
3
  </div>
4
4
 
5
5
  <div class="card my-3" data-live-poll-region="processes">
6
- <div class="list-group list-group-flush text-nowrap" role="table">
6
+ <div class="list-group list-group-flush" role="table">
7
7
  <header class="list-group-item bg-body-tertiary">
8
8
  <div class="row small text-muted text-uppercase align-items-center">
9
9
  <div class="col"><%= t ".process" %></div>
@@ -41,9 +41,9 @@
41
41
  <span class="badge rounded-pill bg-body-secondary text-secondary"><%= (process.state["memory"] / 1024).to_i %> MB</span>
42
42
  </div>
43
43
  </div>
44
- <div class="col">
45
- <% process.schedulers.each do |scheduler| %>
46
- <pre class="mb-0"><%= scheduler.is_a?(Hash) ? scheduler['name'] : scheduler %></pre>
44
+ <div class="col mw-100">
45
+ <% process.schedulers.each do |scheduler_data| %>
46
+ <pre class="mb-0" title="<%= scheduler_data %>">queues=<%= scheduler_data["queues"] %> max_threads=<%= scheduler_data["max_threads"] %></pre>
47
47
  <% end %>
48
48
  </div>
49
49
  <div class="col-2 small"><%= t(ActiveModel::Type::Boolean.new.cast(process.state["cron_enabled"]), scope: "good_job.shared.boolean") %></div>
@@ -1,10 +1,10 @@
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") %>
5
5
  </div>
6
6
  <div class="flex-fill text-end">
7
- <% last_updated_at = Time.current.utc.iso8601 %>
7
+ <% last_updated_at = Time.current.to_s %>
8
8
  <%= t(".last_updated") %>&nbsp;<time id="page-updated-at" datetime="<%= last_updated_at %>"><%= last_updated_at %></time>
9
9
  </div>
10
10
  </div>
@@ -1,24 +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
- <%= csrf_meta_tags %>
8
- <%= csp_meta_tag %>
9
6
 
10
7
  <%# Bootstrap Color Modes
11
8
  "It is suggested to include the JavaScript at the top of your page
12
9
  to reduce potential screen flickering during reloading of your site."
13
10
  https://getbootstrap.com/docs/5.3/customize/color-modes/#javascript
14
11
  %>
15
- <script nonce="<%= content_security_policy_nonce %>">
12
+ <script nonce="<%= content_security_policy_nonce %>">
16
13
  let theme = localStorage.getItem('good_job-theme');
17
14
  if (!["light", "dark"].includes(theme)) {
18
15
  theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
19
16
  }
20
17
  document.documentElement.setAttribute('data-bs-theme', theme);
21
- </script>
18
+ </script>
22
19
 
23
20
  <%# Do not use asset tag helpers to avoid paths being overriden by config.asset_host %>
24
21
  <%= tag.link rel: "stylesheet", href: frontend_static_path(:bootstrap, format: :css, locale: nil), nonce: content_security_policy_nonce %>
@@ -30,6 +27,11 @@
30
27
  <% importmaps = GoodJob::FrontendsController.js_modules.keys.index_with { |module_name| frontend_module_path(module_name, format: :js, locale: nil) } %>
31
28
  <%= tag.script({ imports: importmaps }.to_json.html_safe, type: "importmap", nonce: content_security_policy_nonce) %>
32
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 %>
33
35
  </head>
34
36
  <body>
35
37
  <div class="d-flex flex-column min-vh-100">
@@ -46,6 +46,30 @@
46
46
  ],
47
47
  "note": "Files are explicitly enumerated in the array"
48
48
  },
49
+ {
50
+ "warning_type": "Dangerous Eval",
51
+ "warning_code": 13,
52
+ "fingerprint": "c4c3e1b8b28ebbfd4672cf3e8f0022a27aff3c12dc4fea750b412de1387f91e6",
53
+ "check_name": "Evaluation",
54
+ "message": "Dynamic string evaluated as code",
55
+ "file": "lib/good_job/log_subscriber.rb",
56
+ "line": 256,
57
+ "link": "https://brakemanscanner.org/docs/warning_types/dangerous_eval/",
58
+ "code": "class_eval(\" def #{level}(progname = nil, tags: [], &block) # def info(progname = nil, tags: [], &block)\\n return unless logger # return unless logger\\n #\\n tag_logger(*tags) do # tag_logger(*tags) do\\n logger.#{level}(progname, &block) # logger.info(progname, &block)\\n end # end\\n end #\\n\", \"lib/good_job/log_subscriber.rb\", (256 + 1))",
59
+ "render_path": null,
60
+ "location": {
61
+ "type": "method",
62
+ "class": "LogSubscriber",
63
+ "method": null
64
+ },
65
+ "user_input": null,
66
+ "confidence": "Weak",
67
+ "cwe_id": [
68
+ 913,
69
+ 95
70
+ ],
71
+ "note": ""
72
+ },
49
73
  {
50
74
  "warning_type": "SQL Injection",
51
75
  "warning_code": 0,
@@ -53,7 +77,7 @@
53
77
  "check_name": "SQL",
54
78
  "message": "Possible SQL injection",
55
79
  "file": "app/models/good_job/job.rb",
56
- "line": 135,
80
+ "line": 162,
57
81
  "link": "https://brakemanscanner.org/docs/warning_types/sql_injection/",
58
82
  "code": "Arel.sql(\"(CASE #{queues.map.with_index do\n sanitize_sql_array([\"WHEN queue_name = ? THEN ?\", queue_name, index])\n end.join(\" \")} ELSE #{queues.size} END)\")",
59
83
  "render_path": null,
@@ -93,6 +117,5 @@
93
117
  "note": ""
94
118
  }
95
119
  ],
96
- "updated": "2024-11-16 17:00:20 -0600",
97
- "brakeman_version": "6.2.1"
120
+ "brakeman_version": "7.0.2"
98
121
  }
@@ -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
@@ -109,9 +109,7 @@ module GoodJob
109
109
 
110
110
  # UUID for this capsule; to be used for inspection (not directly for locking jobs).
111
111
  # @return [String]
112
- def process_id
113
- @tracker.process_id
114
- end
112
+ delegate :process_id, to: :@tracker
115
113
 
116
114
  def lower_thread_priority=(value)
117
115
  @lower_thread_priority = value
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?
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "rails"
4
- require "good_job"
5
4
 
6
5
  module GoodJob
7
6
  # Ruby on Rails integration.
@@ -175,9 +175,7 @@ module GoodJob
175
175
 
176
176
  # Get the logger associated with this {LogSubscriber} instance.
177
177
  # @return [Logger]
178
- def logger
179
- GoodJob::LogSubscriber.logger
180
- end
178
+ delegate :logger, to: :'GoodJob::LogSubscriber'
181
179
 
182
180
  class << self
183
181
  # Tracks all loggers that {LogSubscriber} is writing to. You can write to
@@ -340,9 +340,7 @@ module GoodJob # :nodoc:
340
340
  class TimerSet < ::Concurrent::TimerSet
341
341
  # Number of scheduled jobs in the queue
342
342
  # @return [Integer]
343
- def length
344
- @queue.length
345
- end
343
+ delegate :length, to: :@queue
346
344
 
347
345
  # Clear the queue
348
346
  # @return [void]
@@ -2,7 +2,7 @@
2
2
 
3
3
  module GoodJob
4
4
  # GoodJob gem version.
5
- VERSION = '4.11.1'
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,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: good_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.11.1
4
+ version: 4.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-06-30 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activejob
@@ -240,9 +240,9 @@ executables:
240
240
  - good_job
241
241
  extensions: []
242
242
  extra_rdoc_files:
243
- - README.md
244
243
  - CHANGELOG.md
245
244
  - LICENSE.txt
245
+ - README.md
246
246
  files:
247
247
  - CHANGELOG.md
248
248
  - LICENSE.txt
@@ -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.2
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: []