good_job 3.26.0 → 3.26.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: a51ff44544ae7fb381fce50f13d3196d6a561bcdc6a5af7f37ad1e8fb0d6b258
4
- data.tar.gz: 3703fe631d3f549bb152999203e5d67ac6d305c4ac77bba5b47621f3419cef21
3
+ metadata.gz: eedb4c5defcfa2e25d62147f5021bb868ee0a93b74ae680c46ea4e852212d0dc
4
+ data.tar.gz: d0124daaa3d93e7ace5b0764031c44cc06b03559286ebf1e5a36936e414bb50d
5
5
  SHA512:
6
- metadata.gz: ba6647af970ee04455977ccdfb835ac03648bc544ae3606e69e2007d04bf13634f0767c1263738d04101a6839949affd3227a19b1b573d27a6cb8bb4ea56a5b6
7
- data.tar.gz: 3c8e79ae13f69d050f35aea95ebaf4c035a97138a89d24c57430776909d44c9fbbd9a5ab4460ca30efd65c2c16ec231780957c555f43a77dc100388dbfffb341
6
+ metadata.gz: 15c9fbd5228a60caa7a1d13ec9e6165c1a78ea488a9e7dd992cf60339dfb9523ca8cc68efa0588dddf16f491bf065a878837d943355a7bcae8ba80ec998615d4
7
+ data.tar.gz: aea808fb1eb1ce99c9de4b15c429dc8128d7eee29445a1ca5172498d9f919f8596f28416e2967c41d4bcb6e389e098db90f865e9dce1870229131aaa28212930
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.26.1](https://github.com/bensheldon/good_job/tree/v3.26.1) (2024-03-01)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.26.0...v3.26.1)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Ignore job deserialization errors when mass-retrying through the dashboard [\#1269](https://github.com/bensheldon/good_job/pull/1269) ([bensheldon](https://github.com/bensheldon))
10
+
11
+ **Closed issues:**
12
+
13
+ - Plain HTTP 500 Error when retrying a job for deleted record [\#1263](https://github.com/bensheldon/good_job/issues/1263)
14
+
3
15
  ## [v3.26.0](https://github.com/bensheldon/good_job/tree/v3.26.0) (2024-03-01)
4
16
 
5
17
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.25.0...v3.26.0)
@@ -44,10 +44,13 @@ module GoodJob
44
44
  end
45
45
 
46
46
  job
47
- rescue GoodJob::Job::ActionForStateMismatchError, GoodJob::AdvisoryLockable::RecordAlreadyAdvisoryLockedError
47
+ rescue GoodJob::Job::ActiveJobDeserializationError,
48
+ GoodJob::Job::ActionForStateMismatchError,
49
+ GoodJob::AdvisoryLockable::RecordAlreadyAdvisoryLockedError
48
50
  nil
49
51
  end.compact
50
52
 
53
+ # TODO: Put these messages through I18n
51
54
  notice = if processed_jobs.any?
52
55
  "Successfully #{ACTIONS[mass_action]} #{processed_jobs.count} #{'job'.pluralize(processed_jobs.count)}"
53
56
  else
@@ -94,11 +97,14 @@ module GoodJob
94
97
  private
95
98
 
96
99
  def redirect_on_error(exception)
100
+ # TODO: Put these messages through I18n
97
101
  alert = case exception
98
102
  when GoodJob::Job::AdapterNotGoodJobError
99
103
  "Active Job Queue Adapter must be GoodJob."
100
104
  when GoodJob::Job::ActionForStateMismatchError
101
105
  "Job is not in an appropriate state for this action."
106
+ when GoodJob::Job::ActiveJobDeserializationError
107
+ "Active Job data could not be deserialized."
102
108
  else
103
109
  exception.to_s
104
110
  end
@@ -104,8 +104,10 @@ module GoodJob
104
104
  def active_job(ignore_deserialization_errors: false)
105
105
  ActiveJob::Base.deserialize(active_job_data).tap do |aj|
106
106
  aj.send(:deserialize_arguments_if_needed)
107
+ rescue ActiveJob::DeserializationError
108
+ raise unless ignore_deserialization_errors
107
109
  end
108
- rescue ActiveJob::DeserializationError, NameError
110
+ rescue NameError
109
111
  raise unless ignore_deserialization_errors
110
112
  end
111
113
 
@@ -13,6 +13,8 @@ module GoodJob
13
13
  AdapterNotGoodJobError = Class.new(StandardError)
14
14
  # Attached to a Job's Execution when the Job is discarded.
15
15
  DiscardJobError = Class.new(StandardError)
16
+ # Raised when Active Job data cannot be deserialized
17
+ ActiveJobDeserializationError = Class.new(StandardError)
16
18
 
17
19
  class << self
18
20
  delegate :table_name, to: GoodJob::Execution
@@ -186,8 +188,9 @@ module GoodJob
186
188
  def retry_job
187
189
  with_advisory_lock do
188
190
  execution = head_execution(reload: true)
189
- active_job = execution.active_job
191
+ active_job = execution.active_job(ignore_deserialization_errors: true)
190
192
 
193
+ raise ActiveJobDeserializationError if active_job.nil?
191
194
  raise AdapterNotGoodJobError unless active_job.class.queue_adapter.is_a? GoodJob::Adapter
192
195
  raise ActionForStateMismatchError if execution.finished_at.blank? || execution.error.blank?
193
196
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module GoodJob
4
4
  # GoodJob gem version.
5
- VERSION = '3.26.0'
5
+ VERSION = '3.26.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: 3.26.0
4
+ version: 3.26.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon