good_job 3.30.0 → 3.99.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: 7a62f9aed6b7846a54575fc79d8bb6e164f4236a0e1089eeaf2d2d7ded5e2561
4
- data.tar.gz: cf93bd4a95f4cbd143442ecb5e4d3a1eff77cdecd9e703ee711ea22d2aba2b4e
3
+ metadata.gz: ad688cdbb78a81f0ec43164332e370dfa1cd1e63be003a8649ae4af3791da8fe
4
+ data.tar.gz: 3dcbc882063ea4085d4c58d4899a6e4dc4ae893220cc38f4648c4e00759bf27f
5
5
  SHA512:
6
- metadata.gz: aca712916a3b886d92ae128ee6f238a20a6af8d13bfba3b33b4064820fcbe3317f077fb6a4eac39377f14dcfb10078f0e2ed4c21f81ad9422e59769982aa6d8c
7
- data.tar.gz: 2adc01f26ea9e2155073224a1cf9a42049c63f67c7bb5ffc87f07c1dd95f30cbbd958b15f9b50e0bbf645e132b331f592c9aa6cf182b110484bc807f6b024ef2
6
+ metadata.gz: 52c1a70e3d0bc608318692cb7875c8736e36412186b3b53b19bd3ce4ea7535afdd63e16b98bdf89d726e80ffb5d17b18b9ff1d0452c44e4812df21cd77cab3b6
7
+ data.tar.gz: eeee619d6aff6be854122b54262eedf5ee732d7e56bec5ff516705643076e340326788e06fc6684d0e819ffd62dda1c9cc767327ad0b9e6e462feecd7467e862
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.99.0](https://github.com/bensheldon/good_job/tree/v3.99.0) (2024-07-07)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.30.1...v3.99.0)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - Remove deprecation silencers for v3.99 release [\#1395](https://github.com/bensheldon/good_job/pull/1395) ([bensheldon](https://github.com/bensheldon))
10
+ - Add instructions and `GoodJob.v4_ready?` for upgrading to v4 [\#1356](https://github.com/bensheldon/good_job/pull/1356) ([bensheldon](https://github.com/bensheldon))
11
+
12
+ ## [v3.30.1](https://github.com/bensheldon/good_job/tree/v3.30.1) (2024-07-06)
13
+
14
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.30.0...v3.30.1)
15
+
16
+ **Fixed bugs:**
17
+
18
+ - 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))
19
+ - 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))
20
+
21
+ **Merged pull requests:**
22
+
23
+ - Add missing newline after frozen string literal for migrations [\#1392](https://github.com/bensheldon/good_job/pull/1392) ([Earlopain](https://github.com/Earlopain))
24
+ - Temporarily remove JRuby builds [\#1391](https://github.com/bensheldon/good_job/pull/1391) ([bensheldon](https://github.com/bensheldon))
25
+ - Add initial Performance panel to dashboard [\#1388](https://github.com/bensheldon/good_job/pull/1388) ([bensheldon](https://github.com/bensheldon))
26
+ - 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))
27
+
3
28
  ## [v3.30.0](https://github.com/bensheldon/good_job/tree/v3.30.0) (2024-07-05)
4
29
 
5
30
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.29.5...v3.30.0)
data/README.md CHANGED
@@ -53,6 +53,7 @@ For more of the story of GoodJob, read the [introductory blog post](https://isla
53
53
  - [Batches](#batches)
54
54
  - [Updating](#updating)
55
55
  - [Upgrading minor versions](#upgrading-minor-versions)
56
+ - [Upgrading v3 to v4](#upgrading-v3-to-v4)
56
57
  - [Upgrading v2 to v3](#upgrading-v2-to-v3)
57
58
  - [Upgrading v1 to v2](#upgrading-v1-to-v2)
58
59
  - [Go deeper](#go-deeper)
@@ -873,6 +874,27 @@ To perform upgrades to the GoodJob database tables:
873
874
  1. Commit the migration files and resulting `db/schema.rb` changes.
874
875
  1. Deploy the code, run the migrations against the production database, and restart server/worker processes.
875
876
 
877
+ #### Upgrading v3 to v4
878
+
879
+ GoodJob v4 changes how job and job execution records are stored in the database; moving from job and executions being commingled in the `good_jobs` table to separately and discretely storing job executions in `good_job_executions`. To safely upgrade, all unfinished jobs must use the new format. This change was introduced in GoodJob [v3.15.4 (April 2023)](https://github.com/bensheldon/good_job/releases/tag/v3.15.4), so your application is likely ready-to-upgrade already if you have kept up with GoodJob updates.
880
+
881
+ To upgrade:
882
+
883
+ 1. Upgrade to v3.99.x, following the minor version upgrade process, running any remaining database migrations (rails g good_job:update) and addressing deprecation warnings.
884
+ 1. Check if your application is safe to upgrade to the new job record format by running either:
885
+ - In a production console, run `GoodJob.v4_ready?` which should return `true` when safely upgradable.
886
+ - Or, when connected to the production database verify that `SELECT COUNT(*) FROM "good_jobs" WHERE finished_at IS NULL AND is_discrete IS NOT TRUE` returns `0`
887
+
888
+ If not all unfinished jobs are stored in the new format, either wait to upgrade until those jobs finish or discard them. Not waiting could prevent those jobs from successfully running when upgrading to v4.
889
+ 1. Upgrade from v3.99.x to v4.x.
890
+
891
+ Notable changes:
892
+
893
+ - Only supports Rails 6.1+, CRuby 3.0+ and JRuby 9.4+, Postgres 12+. Rails 6.0 is no longer supported. CRuby 2.6 and 2.7 are no longer supported. JRuby 9.3 is no longer supported.
894
+ - Changes job `priority` to give smaller numbers higher priority (default: `0`), in accordance with Active Job's definition of priority.
895
+ - Enqueues and executes jobs via the `GoodJob::Job` model instead of `GoodJob::Execution`
896
+ - Setting `config.good_job.cleanup_interval_jobs`, `GOOD_JOB_CLEANUP_INTERVAL_JOBS`, `config.good_job.cleanup_interval_seconds`, or `GOOD_JOB_CLEANUP_INTERVAL_SECONDS` to `nil` or `""` no longer disables count- or time-based cleanups. Set to `false` to disable, or `-1` to run a cleanup after every job execution.
897
+
876
898
  #### Upgrading v2 to v3
877
899
 
878
900
  GoodJob v3 is operationally identical to v2; upgrading to GoodJob v3 should be simple. If you are already using `>= v2.9+` no other changes are necessary.
@@ -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