good_job 4.12.0 → 4.12.1

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: f8d2230721300457a34764edf4b7b05a7c2e1e58931186a594b505f13c3a35f0
4
- data.tar.gz: 9330aa1ed9b6fea281bbe9cf95c6a46d96f6eb670b12041d113fb56c89228d87
3
+ metadata.gz: 90cb1ad1b70dc5b80b42058a6fb30b88830b204a678e258f920d9e100329895f
4
+ data.tar.gz: 7b3ac07c100a6595d60184b1dd5229383c19edd4e12174e7b58e4d6c51d56597
5
5
  SHA512:
6
- metadata.gz: a545269af550ef4a99d353d2fa0f08c60c002651682dc58b831a85a63aff0703506c19047230d09572de99810c4754e184ec2fcb852429f84330fdde70e855ba
7
- data.tar.gz: cc75f90006b8e24237759f5648ff78a3799c5a67b055df61c73dcc1f71f2cc7b40e3a60f7898f7688609ec677587fe7fd11762a7dbcaa3af75d33319e8f08c58
6
+ metadata.gz: ff13e15e5ca242accb229ba2b81c7b66b928b04ad31dd5b8ec5277190ab7237f795cbeb02f3c3ccecb14b7529415963b9f0a3f97811ed8da2dd676e1a2a3918b
7
+ data.tar.gz: 4001a82fa48e08f192f4157ce122ce531868523248bca5ec6ac332edabb243fa18824486a843609097005c74a96a56cd06e992c6b21467596bd59730337ef98a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [v4.12.1](https://github.com/bensheldon/good_job/tree/v4.12.1) (2025-10-16)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v4.12.0...v4.12.1)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Improve warning color contrast [\#1679](https://github.com/bensheldon/good_job/pull/1679) ([RDIL](https://github.com/RDIL))
10
+
11
+ **Closed issues:**
12
+
13
+ - batch not showing jobs it enqueued [\#1685](https://github.com/bensheldon/good_job/issues/1685)
14
+ - Recommended method to set up job execution timeout [\#1090](https://github.com/bensheldon/good_job/issues/1090)
15
+
16
+ **Merged pull requests:**
17
+
18
+ - Add CI for Rails 8.1 \(rc\) and use postgres 18 [\#1686](https://github.com/bensheldon/good_job/pull/1686) ([Earlopain](https://github.com/Earlopain))
19
+ - Add warning and alternative to Ruby Timeout example [\#1684](https://github.com/bensheldon/good_job/pull/1684) ([seanpdoyle](https://github.com/seanpdoyle))
20
+
3
21
  ## [v4.12.0](https://github.com/bensheldon/good_job/tree/v4.12.0) (2025-09-22)
4
22
 
5
23
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v4.11.2...v4.12.0)
data/README.md CHANGED
@@ -1057,7 +1057,28 @@ end
1057
1057
 
1058
1058
  ### Timeouts
1059
1059
 
1060
- Job timeouts can be configured with an `around_perform`:
1060
+ Avoid using Ruby's built-in [Timeout](https://github.com/ruby/timeout) mechanism
1061
+ ([1](https://www.mikeperham.com/2015/05/08/timeout-rubys-most-dangerous-api/),
1062
+ [2](https://blog.headius.com/2008/02/rubys-threadraise-threadkill-timeoutrb.html)).
1063
+ Instead, declare either of Active Job's [discard_on](https://api.rubyonrails.org/classes/ActiveJob/Exceptions/ClassMethods.html#method-i-discard_on) or [retry_on](https://api.rubyonrails.org/classes/ActiveJob/Exceptions/ClassMethods.html#method-i-retry_on) to handle
1064
+ the underlying mechanism's timeout exceptions (when available).
1065
+
1066
+ For example, rescue from `Net::OpenTimeout` or `Net::ReadTimeout` and discard
1067
+ the job:
1068
+
1069
+ ```ruby
1070
+ class MyJob < ApplicationJob
1071
+ discard_on Net::OpenTimeout, Net::ReadTimeout
1072
+
1073
+ def perform(uri)
1074
+ Net::HTTP.start(uri.host, uri.port, open_timeout: 3, read_timeout: 3) do |http|
1075
+ http.request(...)
1076
+ end
1077
+ end
1078
+ end
1079
+ ```
1080
+
1081
+ If you have no other choice but to use a Ruby Timeout, it can be configured with an `around_perform`:
1061
1082
 
1062
1083
  ```ruby
1063
1084
  class ApplicationJob < ActiveJob::Base
@@ -21,12 +21,11 @@ module GoodJob
21
21
  }.freeze
22
22
 
23
23
  def status_badge(status)
24
- content_tag :span, status_icon(status, class: "text-white") + t(status, scope: 'good_job.status', count: 1),
25
- class: "badge rounded-pill bg-#{STATUS_COLOR.fetch(status)} d-inline-flex gap-2 ps-1 pe-3 align-items-center"
24
+ content_tag :span, status_icon(status) + t(status, scope: 'good_job.status', count: 1),
25
+ class: "badge rounded-pill text-bg-#{STATUS_COLOR.fetch(status)} d-inline-flex gap-2 ps-1 pe-3 align-items-center"
26
26
  end
27
27
 
28
28
  def status_icon(status, **options)
29
- options[:class] ||= "text-#{STATUS_COLOR.fetch(status)}"
30
29
  icon = render_icon STATUS_ICONS.fetch(status)
31
30
  content_tag :span, icon, **options
32
31
  end
@@ -28,7 +28,7 @@
28
28
  </div>
29
29
  <div class="col-4 col-lg-1 text-lg-center">
30
30
  <div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.job.queue" %></div>
31
- <span class="badge bg-primary text-dark font-monospace"><%= job.queue_name %></span>
31
+ <span class="badge text-bg-primary font-monospace"><%= job.queue_name %></span>
32
32
  </div>
33
33
  <div class="col-4 col-lg-1 text-lg-end">
34
34
  <div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.job.priority" %></div>
@@ -37,13 +37,13 @@
37
37
  <div class="col-4 col-lg-1 text-lg-end">
38
38
  <div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.job.labels" %></div>
39
39
  <% job.labels&.each do |label| %>
40
- <span class="badge rounded-pill bg-secondary font-monospace"><%= label %></span>
40
+ <span class="badge rounded-pill text-bg-secondary font-monospace"><%= label %></span>
41
41
  <% end %>
42
42
  </div>
43
43
  <div class="col-4 col-lg-1 text-lg-end">
44
44
  <div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.job.attempts" %></div>
45
45
  <% if job.error %>
46
- <%= tag.span job.executions_count, class: "badge rounded-pill bg-danger",
46
+ <%= tag.span job.executions_count, class: "badge rounded-pill text-bg-danger",
47
47
  data: {
48
48
  bs_toggle: "popover",
49
49
  bs_trigger: "hover focus click",
@@ -52,7 +52,7 @@
52
52
  }
53
53
  %>
54
54
  <% else %>
55
- <% executions_badge_color = job.executions_count > 1 ? "bg-warning" : "bg-secondary" %>
55
+ <% executions_badge_color = job.executions_count > 1 ? "text-bg-warning" : "text-bg-secondary" %>
56
56
  <span class="badge rounded-pill <%= executions_badge_color %>"><%= job.executions_count %></span>
57
57
  <% end %>
58
58
  </div>
@@ -4,7 +4,7 @@
4
4
 
5
5
  <div class="card my-3">
6
6
  <div class="list-group list-group-flush text-nowrap" role="table">
7
- <header class="list-group-item body-secondary">
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-lg-2"></div>
10
10
  <div class="col-lg-2 d-none d-lg-block"><%= t "good_job.models.cron.class" %></div>
@@ -5,7 +5,7 @@
5
5
  <%= tag.div id: dom_id(execution), class: "list-group-item py-3" do %>
6
6
  <div class="row align-items-center text-nowrap">
7
7
  <div class="col-md-5 d-flex gap-2">
8
- <%= tag.span execution.number, class: "badge bg-secondary rounded-pill" %>
8
+ <%= tag.span execution.number, class: "badge text-bg-secondary rounded-pill" %>
9
9
  <%= tag.code link_to(execution.id, "##{dom_id(execution)}", class: "text-muted text-decoration-none small") %>
10
10
  </div>
11
11
  <div class="col-md-2 small">
@@ -77,7 +77,7 @@
77
77
  </div>
78
78
  <div class="col-4 col-lg-1 text-lg-center">
79
79
  <div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.job.queue" %></div>
80
- <span class="badge bg-primary font-monospace"><%= job.queue_name %></span>
80
+ <span class="badge text-bg-primary font-monospace"><%= job.queue_name %></span>
81
81
  </div>
82
82
  <div class="col-4 col-lg-1 text-lg-end">
83
83
  <div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.job.priority" %></div>
@@ -86,13 +86,13 @@
86
86
  <div class="col-4 col-lg-1 text-wrap text-lg-end">
87
87
  <div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.job.labels" %></div>
88
88
  <% job.labels&.each do |label| %>
89
- <span class="badge rounded-pill bg-secondary font-monospace"><%= label %></span>
89
+ <span class="badge rounded-pill text-bg-secondary font-monospace"><%= label %></span>
90
90
  <% end %>
91
91
  </div>
92
92
  <div class="col-4 col-lg-1 text-lg-end">
93
93
  <div class="d-lg-none small text-muted mt-1"><%= t "good_job.models.job.attempts" %></div>
94
94
  <% if job.error %>
95
- <%= tag.span job.executions_count, class: "badge rounded-pill bg-danger",
95
+ <%= tag.span job.executions_count, class: "badge rounded-pill text-bg-danger",
96
96
  data: {
97
97
  bs_toggle: "popover",
98
98
  bs_trigger: "hover focus click",
@@ -101,7 +101,7 @@
101
101
  }
102
102
  %>
103
103
  <% else %>
104
- <% executions_badge_color = job.executions_count > 1 ? "bg-warning" : "bg-secondary" %>
104
+ <% executions_badge_color = job.executions_count > 1 ? "text-bg-warning" : "text-bg-secondary" %>
105
105
  <span class="badge rounded-pill <%= executions_badge_color %>"><%= job.executions_count %></span>
106
106
  <% end %>
107
107
  </div>
@@ -111,7 +111,7 @@
111
111
  <div>
112
112
  <%= status_badge job.status %>
113
113
  <% if job.status == :discarded && job.error_event %>
114
- <div class="text-black text-center">
114
+ <div class="text-center">
115
115
  <small><%= t(job.error_event, scope: 'good_job.error_event') %></small>
116
116
  </div>
117
117
  <% end %>
@@ -14,7 +14,7 @@
14
14
  </div>
15
15
  <div class="col-6 col-md-2">
16
16
  <div class="small text-muted text-uppercase"><%= t "good_job.models.job.queue" %></div>
17
- <div class="badge bg-primary font-monospace my-2">
17
+ <div class="badge text-bg-primary font-monospace my-2">
18
18
  <%= tag.strong @job.queue_name %>
19
19
  </div>
20
20
  </div>
@@ -56,7 +56,7 @@
56
56
  <li class="nav-item">
57
57
  <%= link_to filter.to_params(state: name), class: "nav-link #{'active' if params[:state] == name}" do %>
58
58
  <%= t(name, scope: 'good_job.status') %>
59
- <span data-async-values-target="value" data-async-values-key="<%= name %>" data-async-values-zero-class="bg-secondary" class="badge bg-primary rounded-pill d-none"></span>
59
+ <span data-async-values-target="value" data-async-values-key="<%= name %>" data-async-values-zero-class="text-bg-secondary" class="badge text-bg-primary rounded-pill d-none"></span>
60
60
  <% end %>
61
61
  </li>
62
62
  <% end %>
@@ -18,25 +18,25 @@
18
18
  <li class="nav-item">
19
19
  <%= link_to jobs_path, class: ["nav-link", ("active" if controller_name == 'jobs')] do %>
20
20
  <%= t(".jobs") %>
21
- <span data-async-values-target="value" data-async-values-key="jobs_count" class="badge bg-secondary rounded-pill d-none"></span>
21
+ <span data-async-values-target="value" data-async-values-key="jobs_count" class="badge text-bg-secondary rounded-pill d-none"></span>
22
22
  <% end %>
23
23
  </li>
24
24
  <li class="nav-item">
25
25
  <%= link_to batches_path, class: ["nav-link", ("active" if controller_name == 'batches')] do %>
26
26
  <%= t ".batches" %>
27
- <span data-async-values-target="value" data-async-values-key="batches_count" class="badge bg-secondary rounded-pill d-none"></span>
27
+ <span data-async-values-target="value" data-async-values-key="batches_count" class="badge text-bg-secondary rounded-pill d-none"></span>
28
28
  <% end %>
29
29
  </li>
30
30
  <li class="nav-item">
31
31
  <%= link_to cron_entries_path, class: ["nav-link", ("active" if controller_name == 'cron_entries')] do %>
32
32
  <%= t(".cron_schedules") %>
33
- <span data-async-values-target="value" data-async-values-key="cron_entries_count" class="badge bg-secondary rounded-pill d-none"></span>
33
+ <span data-async-values-target="value" data-async-values-key="cron_entries_count" class="badge text-bg-secondary rounded-pill d-none"></span>
34
34
  <% end %>
35
35
  </li>
36
36
  <li class="nav-item">
37
37
  <%= link_to processes_path, class: ["nav-link", ("active" if controller_name == 'processes')] do %>
38
38
  <%= t(".processes") %>
39
- <span data-async-values-target="value" data-async-values-key="processes_count" data-async-values-zero-class="bg-danger" class="badge bg-secondary rounded-pill d-none"></span>
39
+ <span data-async-values-target="value" data-async-values-key="processes_count" data-async-values-zero-class="text-bg-danger" class="badge text-bg-secondary rounded-pill d-none"></span>
40
40
  <% end %>
41
41
  </li>
42
42
  <li class="nav-item">
@@ -47,13 +47,13 @@
47
47
  <li class="nav-item">
48
48
  <%= link_to pauses_path, class: ["nav-link", ("active" if controller_name == 'pauses')] do %>
49
49
  <%= t(".pauses") %>
50
- <span data-async-values-target="value" data-async-values-key="pauses_count" data-async-values-zero-class="d-none" class="badge bg-warning rounded-pill d-none"></span>
50
+ <span data-async-values-target="value" data-async-values-key="pauses_count" data-async-values-zero-class="d-none" class="badge text-bg-warning rounded-pill d-none"></span>
51
51
  <% end %>
52
52
  </li>
53
53
  <li class="nav-item">
54
54
  <%= link_to cleaner_index_path, class: ["nav-link", ("active" if controller_name == 'cleaner')] do %>
55
55
  <%= t(".cleaner") %>
56
- <span data-async-values-target="value" data-async-values-key="discarded_count" class="badge bg-secondary rounded-pill d-none"></span>
56
+ <span data-async-values-target="value" data-async-values-key="discarded_count" class="badge text-bg-secondary rounded-pill d-none"></span>
57
57
  <% end %>
58
58
  </li>
59
59
  </ul>
@@ -2,7 +2,7 @@
2
2
 
3
3
  module GoodJob
4
4
  # GoodJob gem version.
5
- VERSION = '4.12.0'
5
+ VERSION = '4.12.1'
6
6
 
7
7
  # GoodJob version as Gem::Version object
8
8
  GEM_VERSION = Gem::Version.new(VERSION)
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.12.0
4
+ version: 4.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon