good_job 3.29.5 → 3.30.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +32 -0
  3. data/README.md +3 -3
  4. data/app/controllers/good_job/performances_controller.rb +23 -0
  5. data/app/filters/good_job/base_filter.rb +1 -1
  6. data/app/helpers/good_job/application_helper.rb +1 -0
  7. data/app/models/concerns/good_job/error_events.rb +2 -2
  8. data/app/models/good_job/base_execution.rb +594 -2
  9. data/app/models/good_job/discrete_execution.rb +18 -2
  10. data/app/models/good_job/execution.rb +2 -597
  11. data/app/models/good_job/job.rb +1 -1
  12. data/app/views/good_job/performances/show.html.erb +50 -0
  13. data/app/views/good_job/shared/_navbar.erb +5 -0
  14. data/config/locales/de.yml +11 -0
  15. data/config/locales/en.yml +11 -0
  16. data/config/locales/es.yml +11 -0
  17. data/config/locales/fr.yml +11 -0
  18. data/config/locales/it.yml +11 -0
  19. data/config/locales/ja.yml +11 -0
  20. data/config/locales/ko.yml +11 -0
  21. data/config/locales/nl.yml +11 -0
  22. data/config/locales/pt-BR.yml +11 -0
  23. data/config/locales/ru.yml +11 -0
  24. data/config/locales/tr.yml +11 -0
  25. data/config/locales/uk.yml +11 -0
  26. data/config/routes.rb +2 -0
  27. data/lib/generators/good_job/templates/install/migrations/create_good_jobs.rb.erb +1 -0
  28. data/lib/generators/good_job/templates/update/migrations/13_create_good_job_process_lock_ids.rb.erb +1 -0
  29. data/lib/generators/good_job/templates/update/migrations/14_create_good_job_process_lock_indexes.rb.erb +1 -0
  30. data/lib/generators/good_job/templates/update/migrations/15_create_good_job_execution_duration.rb.erb +15 -0
  31. data/lib/good_job/version.rb +1 -1
  32. data/lib/good_job.rb +2 -2
  33. metadata +5 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26e3887930fc0f923edca0286d1d6c2fff51466f5b395eb122a56f6dd4ec9171
4
- data.tar.gz: 79a670cab496050ddf9cee105be9eab503a4d18f4786ac4a5b04dd3f93e3814a
3
+ metadata.gz: 5ca44ad0fbf6d55478287f58fb49c9295ebcbbb5875ec8c3c2e94859dec23393
4
+ data.tar.gz: ded000fbd60a45e9028a97bda6f1dc0240310a7b9281708d15543331a8a19706
5
5
  SHA512:
6
- metadata.gz: a8f938f53fc9d1e2334b25fb9311f30abffa47fe26b9968d1d7de5f354337c1aeca217cf70fcfc2e5ab15ceba992f9a4edbc7430d5b09733a90221a970fbdebc
7
- data.tar.gz: ad97c2abf1d88cab58898f983991e599b8b55e2f20cc5931b0b2d7ee08292ca9c20652452ebbf853a3f09e96c2134dd7167f158c5a0629390d94c48383a2b436
6
+ metadata.gz: 4d09ea0dcb8801f3ca577b349e9f671bdf70c4df38ace8b96e9b5bda8f22bc2bc4791a261c4816e2beca82aa17f188c9521f89be4460f4097d5e8a03a4f2c281
7
+ data.tar.gz: 73ab002472752c47682c508b4828dfd359e9aebebc997b76f69c91f6cf5dd0ab12a4bc171fbc6f3d967e17b2a4b26a52f6afe311d43dbc90331c565a79443e25
data/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.30.1](https://github.com/bensheldon/good_job/tree/v3.30.1) (2024-07-06)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.30.0...v3.30.1)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Fix Performance table formatting, change url from `performances` to singular `performance` [\#1393](https://github.com/bensheldon/good_job/pull/1393) ([bensheldon](https://github.com/bensheldon))
10
+ - Add a version check for Rails whether to use pg interval or calculate float [\#1389](https://github.com/bensheldon/good_job/pull/1389) ([bensheldon](https://github.com/bensheldon))
11
+
12
+ **Merged pull requests:**
13
+
14
+ - Add missing newline after frozen string literal for migrations [\#1392](https://github.com/bensheldon/good_job/pull/1392) ([Earlopain](https://github.com/Earlopain))
15
+ - Temporarily remove JRuby builds [\#1391](https://github.com/bensheldon/good_job/pull/1391) ([bensheldon](https://github.com/bensheldon))
16
+ - Add initial Performance panel to dashboard [\#1388](https://github.com/bensheldon/good_job/pull/1388) ([bensheldon](https://github.com/bensheldon))
17
+ - Move job execution logic from Execution to BaseExecution to simplify v4 changes [\#1357](https://github.com/bensheldon/good_job/pull/1357) ([bensheldon](https://github.com/bensheldon))
18
+
19
+ ## [v3.30.0](https://github.com/bensheldon/good_job/tree/v3.30.0) (2024-07-05)
20
+
21
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.29.5...v3.30.0)
22
+
23
+ **Implemented enhancements:**
24
+
25
+ - Added GoodJob::DiscreteExecution\#duration column [\#1374](https://github.com/bensheldon/good_job/pull/1374) ([SebouChu](https://github.com/SebouChu))
26
+
27
+ **Closed issues:**
28
+
29
+ - Job retried infinitely [\#1384](https://github.com/bensheldon/good_job/issues/1384)
30
+
31
+ **Merged pull requests:**
32
+
33
+ - Use newer syntax in documentation for `wait` config on `retry` [\#1380](https://github.com/bensheldon/good_job/pull/1380) ([benoittgt](https://github.com/benoittgt))
34
+
3
35
  ## [v3.29.5](https://github.com/bensheldon/good_job/tree/v3.29.5) (2024-06-24)
4
36
 
5
37
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.29.4...v3.29.5)
data/README.md CHANGED
@@ -933,7 +933,7 @@ Active Job can be configured to retry an infinite number of times, with a polyno
933
933
 
934
934
  ```ruby
935
935
  class ApplicationJob < ActiveJob::Base
936
- retry_on StandardError, wait: :exponentially_longer, attempts: Float::INFINITY
936
+ retry_on StandardError, wait: :polynomially_longer, attempts: Float::INFINITY
937
937
  # ...
938
938
  end
939
939
  ```
@@ -953,7 +953,7 @@ When using `retry_on` with an infinite number of retries, exceptions will never
953
953
 
954
954
  ```ruby
955
955
  class ApplicationJob < ActiveJob::Base
956
- retry_on StandardError, wait: :exponentially_longer, attempts: Float::INFINITY
956
+ retry_on StandardError, wait: :polynomially_longer, attempts: Float::INFINITY
957
957
 
958
958
  retry_on SpecialError, attempts: 5 do |_job, exception|
959
959
  Rails.error.report(exception)
@@ -979,7 +979,7 @@ You can use an initializer to configure `ActionMailer::MailDeliveryJob`, for exa
979
979
 
980
980
  ```ruby
981
981
  # config/initializers/good_job.rb
982
- ActionMailer::MailDeliveryJob.retry_on StandardError, wait: :exponentially_longer, attempts: Float::INFINITY
982
+ ActionMailer::MailDeliveryJob.retry_on StandardError, wait: :polynomially_longer, attempts: Float::INFINITY
983
983
 
984
984
  # With Sentry (or Bugsnag, Airbrake, Honeybadger, etc.)
985
985
  ActionMailer::MailDeliveryJob.around_perform do |_job, block|
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GoodJob
4
+ class PerformancesController < ApplicationController
5
+ def show
6
+ if GoodJob::DiscreteExecution.duration_interval_migrated?
7
+ @performances = GoodJob::DiscreteExecution
8
+ .where.not(job_class: nil)
9
+ .group(:job_class)
10
+ .select("
11
+ job_class,
12
+ COUNT(*) AS executions_count,
13
+ AVG(duration) AS avg_duration,
14
+ MIN(duration) AS min_duration,
15
+ MAX(duration) AS max_duration
16
+ ")
17
+ .order("job_class")
18
+ else
19
+ @needs_upgrade = true
20
+ end
21
+ end
22
+ end
23
+ end
@@ -33,7 +33,7 @@ module GoodJob
33
33
 
34
34
  def job_classes
35
35
  filtered_query(params.slice(:queue_name)).unscope(:select)
36
- .group(GoodJob::BaseExecution.params_job_class).count
36
+ .group(GoodJob::Job.params_job_class).count
37
37
  .sort_by { |name, _count| name.to_s }
38
38
  .to_h
39
39
  end
@@ -9,6 +9,7 @@ module GoodJob
9
9
 
10
10
  def format_duration(sec)
11
11
  return unless sec
12
+ return "" if sec.is_a?(String) # pg interval support added in Rails 6.1
12
13
 
13
14
  if sec < 1
14
15
  t 'good_job.duration.milliseconds', ms: (sec * 1000).floor
@@ -27,7 +27,7 @@ module GoodJob
27
27
  def error_event
28
28
  return unless self.class.columns_hash['error_event']
29
29
 
30
- enum = super
30
+ enum = read_attribute(:error_event)
31
31
  return unless enum
32
32
 
33
33
  ERROR_EVENT_ENUMS.key(enum)
@@ -39,7 +39,7 @@ module GoodJob
39
39
  enum = ERROR_EVENT_ENUMS[event]
40
40
  raise(ArgumentError, "Invalid error_event: #{event}") if event && !enum
41
41
 
42
- super(enum)
42
+ write_attribute(:error_event, enum)
43
43
  end
44
44
  end
45
45
  end