good_job 3.5.0 → 3.5.1

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: 7cc0961bf8aed9531b101c7d9a2be80693bd16dadf7239aa76b25adfea24f27c
4
- data.tar.gz: 0740f33be940345ef16ebea8a8f188ebac56fe27af260f5510e7ed3d2ce98a96
3
+ metadata.gz: 1d98ed0a03595d8d2a70f2a811296cf01d1b0a4d9ff480d0a480fb91591ecafd
4
+ data.tar.gz: 90307d30a72de7f7af5d33a7d64ec9eaa67bb42fc8e8179e48c96f22a0440b5e
5
5
  SHA512:
6
- metadata.gz: 0bdb4e1dab74099990750ea9239fe741432969d4aa412a8fdead0cbd4b43f5a7ae07732c78ff7ce82aedd534d5c6a27122be1c4b390f75982531ec0ed37ad9e8
7
- data.tar.gz: 04b50734aab939660d38b28076c1ca7fe13f19894fe419cd09f9d099c1cdb2253c9ec0d8c90fdb54fe2bdeeff58646e3f366f3bcaf86638bb9dbd579194bb4c1
6
+ metadata.gz: 710500b2704938b319863efe46d462296afa19f11177fb7e03f64e3cfa32872b1d1c8e793a58e6561e0f15a36125b4c3485be99edf6d1e2f8d9953da408ecb3b
7
+ data.tar.gz: 6d0ae65d53a40340e846cd393a3936fe6ece5b7f5e2ccfdf17ee99f628f528135af11bb2714ee223f1e800b4ced333acc7616a153774d85d9889a0e17753a162
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.5.1](https://github.com/bensheldon/good_job/tree/v3.5.1) (2022-10-20)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.5.0...v3.5.1)
6
+
7
+ **Closed issues:**
8
+
9
+ - Assert cancelled jobs [\#724](https://github.com/bensheldon/good_job/issues/724)
10
+
11
+ **Merged pull requests:**
12
+
13
+ - Revert "When not preserving job records, ensure all prior executions are deleted after successful retry" because some retry patterns stopped working [\#729](https://github.com/bensheldon/good_job/pull/729) ([bensheldon](https://github.com/bensheldon))
14
+
3
15
  ## [v3.5.0](https://github.com/bensheldon/good_job/tree/v3.5.0) (2022-10-18)
4
16
 
5
17
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.4.8...v3.5.0)
@@ -66,7 +66,6 @@ module GoodJob
66
66
  end
67
67
 
68
68
  belongs_to :job, class_name: 'GoodJob::Job', foreign_key: 'active_job_id', primary_key: 'active_job_id', optional: true, inverse_of: :executions
69
- after_destroy -> { self.class.active_job_id(active_job_id).delete_all }, if: -> { @_destroy_job }
70
69
 
71
70
  # Get executions with given ActiveJob ID
72
71
  # @!method active_job_id
@@ -299,11 +298,11 @@ module GoodJob
299
298
 
300
299
  if result.unhandled_error && GoodJob.retry_on_unhandled_error
301
300
  save!
302
- elsif GoodJob.preserve_job_records == true || result.retried? || (result.unhandled_error && GoodJob.preserve_job_records == :on_unhandled_error)
301
+ elsif GoodJob.preserve_job_records == true || (result.unhandled_error && GoodJob.preserve_job_records == :on_unhandled_error)
303
302
  self.finished_at = Time.current
304
303
  save!
305
304
  else
306
- destroy_job
305
+ destroy!
307
306
  end
308
307
 
309
308
  result
@@ -355,14 +354,6 @@ module GoodJob
355
354
  (finished_at || Time.zone.now) - performed_at if performed_at
356
355
  end
357
356
 
358
- # Destroys this execution and all executions within the same job
359
- def destroy_job
360
- @_destroy_job = true
361
- destroy!
362
- ensure
363
- @_destroy_job = false
364
- end
365
-
366
357
  private
367
358
 
368
359
  def active_job_data
@@ -388,7 +379,7 @@ module GoodJob
388
379
  end
389
380
  handled_error ||= current_thread.error_on_retry || current_thread.error_on_discard
390
381
 
391
- ExecutionResult.new(value: value, handled_error: handled_error, retried: current_thread.error_on_retry.present?)
382
+ ExecutionResult.new(value: value, handled_error: handled_error)
392
383
  rescue StandardError => e
393
384
  ExecutionResult.new(value: nil, unhandled_error: e)
394
385
  end
@@ -8,18 +8,14 @@ module GoodJob
8
8
  attr_reader :handled_error
9
9
  # @return [Exception, nil]
10
10
  attr_reader :unhandled_error
11
- # @return [Exception, nil]
12
- attr_reader :retried
13
- alias retried? retried
14
11
 
15
12
  # @param value [Object, nil]
16
13
  # @param handled_error [Exception, nil]
17
14
  # @param unhandled_error [Exception, nil]
18
- def initialize(value:, handled_error: nil, unhandled_error: nil, retried: false)
15
+ def initialize(value:, handled_error: nil, unhandled_error: nil)
19
16
  @value = value
20
17
  @handled_error = handled_error
21
18
  @unhandled_error = unhandled_error
22
- @retried = retried
23
19
  end
24
20
  end
25
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module GoodJob
3
3
  # GoodJob gem version.
4
- VERSION = '3.5.0'
4
+ VERSION = '3.5.1'
5
5
  end
data/lib/good_job.rb CHANGED
@@ -57,7 +57,7 @@ module GoodJob
57
57
  # By default, GoodJob deletes job records after the job is completed successfully.
58
58
  # If you want to preserve jobs for latter inspection, set this to +true+.
59
59
  # If you want to preserve only jobs that finished with error for latter inspection, set this to +:on_unhandled_error+.
60
- # @return [Boolean, Symbol, nil]
60
+ # @return [Boolean, nil]
61
61
  mattr_accessor :preserve_job_records, default: true
62
62
 
63
63
  # @!attribute [rw] retry_on_unhandled_error
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.5.0
4
+ version: 3.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-18 00:00:00.000000000 Z
11
+ date: 2022-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob