good_job 3.12.7 → 3.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24b3e7de3de7bb0365a230607a0f1f566d431adcd508ce7ee23406164c6528bc
4
- data.tar.gz: cd84291baf21cbaabbc543510851481ee835278bd1e844380be99fff749e0702
3
+ metadata.gz: c83cf253d12daeb00363fe9c1b3a06b463c6944aa108aa4f884bf43b0d1f5c88
4
+ data.tar.gz: 71738f01485fb73b1dfa71396807f4570922d53aa186bf7aa1f9c27b21e4e559
5
5
  SHA512:
6
- metadata.gz: d79680539f1dfabf4076e313207a54b3f38370f31ca855fdc3cf5bfc20799dd2e6b2495274055a45027459f31439dd11677f270ef823ec6c64b8f44359691312
7
- data.tar.gz: 1606e6811d188bd18d56d368fe712871193283c93f3f52c5300052884e4ca1fbb3e8ab502499add0b9364780eca13154ca9cb6c2bfdc8674ca3dd6b157f28209
6
+ metadata.gz: 25bbd078a94d5079b47d57c267ad72f7e6baa024230add7fd9c693c621eb8be7117aa517f715baba5b16cb5f0378eb0e407a41ea1569e923a16716ef0f4d391b
7
+ data.tar.gz: cf58cbaea01a1dd6714b53c6d618661908ccf46ef3deae58b3e2d6063f512e528d0d4f04850e7a3c4a1ccc59ece959a0919d19898488116898f78b9c78c7a5f6
data/CHANGELOG.md CHANGED
@@ -1,17 +1,52 @@
1
1
  # Changelog
2
2
 
3
- ## [v3.12.7](https://github.com/bensheldon/good_job/tree/v3.12.7) (2023-03-01)
3
+ ## [v3.13.0](https://github.com/bensheldon/good_job/tree/v3.13.0) (2023-03-08)
4
4
 
5
- [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.12.6...v3.12.7)
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.12.8...v3.13.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - If logging to STDOUT in CLI set $stdout.sync = true [\#882](https://github.com/bensheldon/good_job/pull/882) ([blafri](https://github.com/blafri))
6
10
 
7
11
  **Fixed bugs:**
8
12
 
9
- - Rename "assets" to "frontends" to avoid Asset Pipeline collisions [\#874](https://github.com/bensheldon/good_job/pull/874) ([bensheldon](https://github.com/bensheldon))
13
+ - Don't load all Executions on Jobs Dashboard [\#878](https://github.com/bensheldon/good_job/pull/878) ([bensheldon](https://github.com/bensheldon))
14
+
15
+ **Closed issues:**
16
+
17
+ - No route matches \[POST\] "/scheduler-dashboard/jobs/\<id\>/retry" [\#880](https://github.com/bensheldon/good_job/issues/880)
18
+ - What is `concurrency_key` used for? [\#877](https://github.com/bensheldon/good_job/issues/877)
19
+ - ArgumentError in GoodJob::Jobs\#index [\#875](https://github.com/bensheldon/good_job/issues/875)
20
+ - Nonworking dashboard for job with many retries [\#809](https://github.com/bensheldon/good_job/issues/809)
21
+
22
+ **Merged pull requests:**
23
+
24
+ - Add aggressive test for async Batches [\#833](https://github.com/bensheldon/good_job/pull/833) ([bensheldon](https://github.com/bensheldon))
25
+
26
+ ## [v3.12.8](https://github.com/bensheldon/good_job/tree/v3.12.8) (2023-03-06)
27
+
28
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.12.7...v3.12.8)
29
+
30
+ **Fixed bugs:**
31
+
32
+ - Add `raise: false` to FrontendsController after action skip [\#881](https://github.com/bensheldon/good_job/pull/881) ([simi](https://github.com/simi))
10
33
 
11
34
  **Closed issues:**
12
35
 
13
36
  - GoodJob's JavaScript takes precedence over application's JavaScript in GoodJob 3.12.6, Rails 7 [\#873](https://github.com/bensheldon/good_job/issues/873)
14
37
 
38
+ **Merged pull requests:**
39
+
40
+ - Rewrite flaky tests: don't allow nil timeout for restart [\#872](https://github.com/bensheldon/good_job/pull/872) ([bensheldon](https://github.com/bensheldon))
41
+
42
+ ## [v3.12.7](https://github.com/bensheldon/good_job/tree/v3.12.7) (2023-03-01)
43
+
44
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.12.6...v3.12.7)
45
+
46
+ **Fixed bugs:**
47
+
48
+ - Rename "assets" to "frontends" to avoid Asset Pipeline collisions [\#874](https://github.com/bensheldon/good_job/pull/874) ([bensheldon](https://github.com/bensheldon))
49
+
15
50
  ## [v3.12.6](https://github.com/bensheldon/good_job/tree/v3.12.6) (2023-03-01)
16
51
 
17
52
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.12.5...v3.12.6)
@@ -158,7 +193,7 @@
158
193
 
159
194
  **Closed issues:**
160
195
 
161
- - Support for Ruby 3.2 [\#785](https://github.com/bensheldon/good_job/issues/785)
196
+ - Support for Rails 6.1 / Ruby 3.2 [\#785](https://github.com/bensheldon/good_job/issues/785)
162
197
  - Custom table names [\#748](https://github.com/bensheldon/good_job/issues/748)
163
198
  - Health check issue with cron scheduler job [\#741](https://github.com/bensheldon/good_job/issues/741)
164
199
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  module GoodJob
3
3
  class FrontendsController < ActionController::Base # rubocop:disable Rails/ApplicationController
4
- skip_after_action :verify_same_origin_request
4
+ skip_after_action :verify_same_origin_request, raise: false
5
5
 
6
6
  STATIC_ASSETS = {
7
7
  css: {
@@ -2,15 +2,17 @@
2
2
  module GoodJob
3
3
  class JobsFilter < BaseFilter
4
4
  def states
5
- query = filtered_query(params.except(:state))
6
- {
7
- 'scheduled' => query.scheduled.count,
8
- 'retried' => query.retried.count,
9
- 'queued' => query.queued.count,
10
- 'running' => query.running.count,
11
- 'succeeded' => query.succeeded.count,
12
- 'discarded' => query.discarded.count,
13
- }
5
+ @_states ||= begin
6
+ query = filtered_query(params.except(:state))
7
+ {
8
+ 'scheduled' => query.scheduled.count,
9
+ 'retried' => query.retried.count,
10
+ 'queued' => query.queued.count,
11
+ 'running' => query.running.count,
12
+ 'succeeded' => query.succeeded.count,
13
+ 'discarded' => query.discarded.count,
14
+ }
15
+ end
14
16
  end
15
17
 
16
18
  def filtered_query(filter_params = params)
@@ -42,13 +44,13 @@ module GoodJob
42
44
  end
43
45
 
44
46
  def filtered_count
45
- filtered_query.unscope(:select).count
47
+ @_filtered_count ||= filtered_query.unscope(:select).count
46
48
  end
47
49
 
48
50
  private
49
51
 
50
52
  def query_for_records
51
- filtered_query.includes(:executions).includes_advisory_locks
53
+ filtered_query.includes_advisory_locks
52
54
  end
53
55
 
54
56
  def default_base_query
@@ -136,6 +136,16 @@ module GoodJob
136
136
  error || executions[-2]&.error
137
137
  end
138
138
 
139
+ # Errors for the job to be displayed in the Dashboard.
140
+ # @return [String]
141
+ def display_error
142
+ return error if error.present?
143
+
144
+ serialized_params.fetch('exception_executions', {}).map do |exception, count|
145
+ "#{exception}: #{count}"
146
+ end.join(', ')
147
+ end
148
+
139
149
  # Return formatted serialized_params for display in the dashboard
140
150
  # @return [Hash]
141
151
  def display_serialized_params
@@ -82,7 +82,7 @@
82
82
  bs_toggle: "popover",
83
83
  bs_trigger: "hover focus click",
84
84
  bs_placement: "bottom",
85
- bs_content: job.recent_error
85
+ bs_content: job.display_error,
86
86
  } %>
87
87
  <% else %>
88
88
  <span class="badge bg-secondary bg-opacity-50 rounded-pill"><%= job.executions_count %></span>
@@ -55,9 +55,11 @@ module GoodJob
55
55
  end
56
56
 
57
57
  # Shutdown and then start the capsule again.
58
- # @param timeout [nil, Numeric, Symbol] Seconds to wait for active threads.
58
+ # @param timeout [Numeric, Symbol] Seconds to wait for active threads.
59
59
  # @return [void]
60
60
  def restart(timeout: :default)
61
+ raise ArgumentError, "Capsule#restart cannot be called with a timeout of nil" if timeout.nil?
62
+
61
63
  shutdown(timeout: timeout)
62
64
  start
63
65
  end
data/lib/good_job/cli.rb CHANGED
@@ -148,7 +148,10 @@ module GoodJob
148
148
  # Rails or from the application can be set up here.
149
149
  def set_up_application!
150
150
  require RAILS_ENVIRONMENT_RB
151
- return if !GoodJob::CLI.log_to_stdout? || ActiveSupport::Logger.logger_outputs_to?(GoodJob.logger, $stdout)
151
+ return unless GoodJob::CLI.log_to_stdout?
152
+
153
+ $stdout.sync = true
154
+ return if ActiveSupport::Logger.logger_outputs_to?(GoodJob.logger, $stdout)
152
155
 
153
156
  GoodJob::LogSubscriber.loggers << ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new($stdout))
154
157
  GoodJob::LogSubscriber.reset_logger
@@ -132,11 +132,13 @@ module GoodJob # :nodoc:
132
132
 
133
133
  # Restart the Scheduler.
134
134
  # When shutdown, start; or shutdown and start.
135
- # @param timeout [nil, Numeric] Seconds to wait for actively executing jobs to finish; shares same values as {#shutdown}.
135
+ # @param timeout [Numeric] Seconds to wait for actively executing jobs to finish; shares same values as {#shutdown}.
136
136
  # @return [void]
137
137
  def restart(timeout: -1)
138
+ raise ArgumentError, "Scheduler#restart cannot be called with a timeout of nil" if timeout.nil?
139
+
138
140
  instrument("scheduler_restart_pools") do
139
- shutdown(timeout: timeout) if running?
141
+ shutdown(timeout: timeout)
140
142
  create_executor
141
143
  warm_cache
142
144
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module GoodJob
3
3
  # GoodJob gem version.
4
- VERSION = '3.12.7'
4
+ VERSION = '3.13.0'
5
5
  end
data/lib/good_job.rb CHANGED
@@ -131,7 +131,7 @@ module GoodJob
131
131
  # When forking processes you should shut down these background threads before forking, and restart them after forking.
132
132
  # For example, you should use +shutdown+ and +restart+ when using async execution mode with Puma.
133
133
  # See the {file:README.md#executing-jobs-async--in-process} for more explanation and examples.
134
- # @param timeout [Numeric, nil] Seconds to wait for active threads to finish.
134
+ # @param timeout [Numeric] Seconds to wait for active threads to finish.
135
135
  # @return [void]
136
136
  def self.restart(timeout: -1)
137
137
  _shutdown_all(Capsule.instances, :restart, timeout: timeout)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: good_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.12.7
4
+ version: 3.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-01 00:00:00.000000000 Z
11
+ date: 2023-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob