good_job 4.11.1 → 4.11.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: c69e8c15dd5fb5a07db3dd7bba0c71d9a519dd493c81510cb5ff8ff2cc3aa511
4
- data.tar.gz: 7d6c2e2b36b732bdef7d1176f9c56c1f2846f9c8eb3f919af80c039cbf5b4fce
3
+ metadata.gz: 5de7dadf0496603de0b1b38fbb1df12745078c8cb529f615f2495c6ff926caca
4
+ data.tar.gz: 94a0e727f0523e64ceb63cec668cd532c25e55cb0257a2f5c4328762aacef6cd
5
5
  SHA512:
6
- metadata.gz: 1a02075581a2d702880e99804db959c67d40d06d946a4392961d635c3b57c484c54755c2fe2cc024e9ca0eac5c9d40a164181dc515e07d6b48672553f907cf75
7
- data.tar.gz: 19db6c5195211f4fd0c1eda703d4cf6444ae4afcb4cb8b5388e44d9c0fa21ca5007c97c438b8821b8871a304842c4ad536ae8878eb4b29fdf585b08c78a983da
6
+ metadata.gz: 44614cb9f776531726c775baf89e8433306c4cad9f477099fb4c752ef6ba6e9504e8001f95ec37db1ce366925da183a530d7c3ba259b070d4b24a6a617379d30
7
+ data.tar.gz: d4eac5bbaf7b13f7431fdeb550f4390215df86cd02cb063da24aaab058e5e70dda336aa5543cd71bb20690292d7da8a6ccf5a24c438dbb30b5b99e353fbbe01f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## [v4.11.2](https://github.com/bensheldon/good_job/tree/v4.11.2) (2025-08-06)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v4.11.1...v4.11.2)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Add a favicon [\#1664](https://github.com/bensheldon/good_job/pull/1664) ([itsalongstory](https://github.com/itsalongstory))
10
+
11
+ **Fixed bugs:**
12
+
13
+ - UI: Add `.text-wrap` to the Cron Entry key [\#1667](https://github.com/bensheldon/good_job/pull/1667) ([seanpdoyle](https://github.com/seanpdoyle))
14
+ - Fix duplicate parameters [\#1648](https://github.com/bensheldon/good_job/pull/1648) ([itsalongstory](https://github.com/itsalongstory))
15
+
16
+ **Closed issues:**
17
+
18
+ - проблема с вб [\#1665](https://github.com/bensheldon/good_job/issues/1665)
19
+
20
+ **Merged pull requests:**
21
+
22
+ - Docufix: correct connects\_to statement for multiple databases setup [\#1663](https://github.com/bensheldon/good_job/pull/1663) ([amo13](https://github.com/amo13))
23
+ - Update development dependencies and Rubocop [\#1662](https://github.com/bensheldon/good_job/pull/1662) ([bensheldon](https://github.com/bensheldon))
24
+ - Remove circular dependency of requiring good\_job in engine [\#1655](https://github.com/bensheldon/good_job/pull/1655) ([bensheldon](https://github.com/bensheldon))
25
+ - 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))
26
+ - 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))
27
+
3
28
  ## [v4.11.1](https://github.com/bensheldon/good_job/tree/v4.11.1) (2025-06-30)
4
29
 
5
30
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v4.11.0...v4.11.1)
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
@@ -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)
@@ -25,7 +25,7 @@
25
25
  <div id="<%= dom_id(cron_entry) %>" class="list-group-item py-3" role="row">
26
26
  <div class="row align-items-center">
27
27
  <div class="col-12 col-lg-2">
28
- <div class="small font-monospace"><%= cron_entry.key %></div>
28
+ <div class="small font-monospace text-wrap"><%= cron_entry.key %></div>
29
29
  <div class="small text-muted text-wrap"><%= cron_entry.description %></div>
30
30
  </div>
31
31
  <div class="col-12 col-lg-2 text-wrap"><%= tag.span tag.code(cron_entry.job_class), class: "fs-5 mb-0" %></div>
@@ -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>
@@ -4,7 +4,7 @@
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>
@@ -4,6 +4,7 @@
4
4
  <title>Good Job Dashboard</title>
5
5
  <meta charset="utf-8">
6
6
  <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>">
7
8
  <%= csrf_meta_tags %>
8
9
  <%= csp_meta_tag %>
9
10
 
@@ -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
  }
@@ -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
@@ -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.11.2'
6
6
 
7
7
  # GoodJob version as Gem::Version object
8
8
  GEM_VERSION = Gem::Version.new(VERSION)
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.11.2
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
@@ -421,7 +421,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
421
421
  - !ruby/object:Gem::Version
422
422
  version: '0'
423
423
  requirements: []
424
- rubygems_version: 3.6.2
424
+ rubygems_version: 3.6.9
425
425
  specification_version: 4
426
426
  summary: A multithreaded, Postgres-based ActiveJob backend for Ruby on Rails
427
427
  test_files: []