good_job 3.4.7 → 3.4.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/app/models/good_job/execution.rb +12 -3
- data/app/models/good_job/execution_result.rb +5 -1
- data/lib/good_job/version.rb +1 -1
- data/lib/good_job.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a80a59cedda856949e71696310b0b241e1c48f9959c07275ad6afadf02694db1
|
4
|
+
data.tar.gz: bd60e75a3f468681f7cdea53d8681b9f04ff66e3ea55aa2430cd514805eff1b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5da8d6fc72c367dee54984d411cef1c34a5cdf4e1d32b2f80e8e787a02cc159e59e004c02695888da6cf5e2dc940a5bb9e3b2452247a7594390c0df8c31a1e56
|
7
|
+
data.tar.gz: e3a3821681ec9ee55bd5e364c41d4b0bc43801ad51e144a4910b81bd37d68149d03c507bd09e11520cdab1dcc8dbc5f1283a7c332e50c1c06d3fa28db21e0dfc
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v3.4.8](https://github.com/bensheldon/good_job/tree/v3.4.8) (2022-10-11)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.4.7...v3.4.8)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- When not preserving job records, ensure all prior executions are deleted after successful retry [\#719](https://github.com/bensheldon/good_job/pull/719) ([ylansegal](https://github.com/ylansegal))
|
10
|
+
|
3
11
|
## [v3.4.7](https://github.com/bensheldon/good_job/tree/v3.4.7) (2022-10-06)
|
4
12
|
|
5
13
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.4.6...v3.4.7)
|
@@ -66,6 +66,7 @@ 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 }
|
69
70
|
|
70
71
|
# Get Jobs with given ActiveJob ID
|
71
72
|
# @!method active_job_id
|
@@ -298,11 +299,11 @@ module GoodJob
|
|
298
299
|
|
299
300
|
if result.unhandled_error && GoodJob.retry_on_unhandled_error
|
300
301
|
save!
|
301
|
-
elsif GoodJob.preserve_job_records == true || (result.unhandled_error && GoodJob.preserve_job_records == :on_unhandled_error)
|
302
|
+
elsif GoodJob.preserve_job_records == true || result.retried? || (result.unhandled_error && GoodJob.preserve_job_records == :on_unhandled_error)
|
302
303
|
self.finished_at = Time.current
|
303
304
|
save!
|
304
305
|
else
|
305
|
-
|
306
|
+
destroy_job
|
306
307
|
end
|
307
308
|
|
308
309
|
result
|
@@ -354,6 +355,14 @@ module GoodJob
|
|
354
355
|
(finished_at || Time.zone.now) - performed_at if performed_at
|
355
356
|
end
|
356
357
|
|
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
|
+
|
357
366
|
private
|
358
367
|
|
359
368
|
def active_job_data
|
@@ -379,7 +388,7 @@ module GoodJob
|
|
379
388
|
end
|
380
389
|
handled_error ||= current_thread.error_on_retry || current_thread.error_on_discard
|
381
390
|
|
382
|
-
ExecutionResult.new(value: value, handled_error: handled_error)
|
391
|
+
ExecutionResult.new(value: value, handled_error: handled_error, retried: current_thread.error_on_retry.present?)
|
383
392
|
rescue StandardError => e
|
384
393
|
ExecutionResult.new(value: nil, unhandled_error: e)
|
385
394
|
end
|
@@ -8,14 +8,18 @@ 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
|
11
14
|
|
12
15
|
# @param value [Object, nil]
|
13
16
|
# @param handled_error [Exception, nil]
|
14
17
|
# @param unhandled_error [Exception, nil]
|
15
|
-
def initialize(value:, handled_error: nil, unhandled_error: nil)
|
18
|
+
def initialize(value:, handled_error: nil, unhandled_error: nil, retried: false)
|
16
19
|
@value = value
|
17
20
|
@handled_error = handled_error
|
18
21
|
@unhandled_error = unhandled_error
|
22
|
+
@retried = retried
|
19
23
|
end
|
20
24
|
end
|
21
25
|
end
|
data/lib/good_job/version.rb
CHANGED
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, nil]
|
60
|
+
# @return [Boolean, Symbol, 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.4.
|
4
|
+
version: 3.4.8
|
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-
|
11
|
+
date: 2022-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|