good_job 1.2.6 → 1.3.0
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 +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +6 -3
- data/lib/good_job.rb +18 -2
- data/lib/good_job/cli.rb +1 -1
- data/lib/good_job/configuration.rb +1 -1
- data/lib/good_job/job.rb +1 -1
- data/lib/good_job/version.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: 17fac9485f08bf55c8d2b2fbbc6e85efde95202d759d6155a4b23bf0755236ce
|
4
|
+
data.tar.gz: 562115863243ac98e3fd0cca7c04ad9f57a80f932682d7161e43336b521ea62d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a06ee5d2bea077e7b612f6d44aa30666d52517849e5345d8882a9f21653513be2386e577dbbab8ad41897aeb48d14885cbfe8cd51784c96da300aee7233a5190
|
7
|
+
data.tar.gz: 7c366b21a4f28d66ce8d59d22fa56a081a63c181ee0b35ddd7965422c7c758f020bc7fba42aa34e61ec8abb17e9dcc5a9d0cb3b15f2d1c03d7153d83d7fbffdd
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v1.3.0](https://github.com/bensheldon/good_job/tree/v1.3.0) (2020-10-03)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v1.2.6...v1.3.0)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- Lengthen default poll interval from 1 to 5 seconds [\#156](https://github.com/bensheldon/good_job/pull/156) ([bensheldon](https://github.com/bensheldon))
|
10
|
+
- Rename reperform\_jobs\_on\_standard\_error to retry\_on\_unhandled\_error [\#154](https://github.com/bensheldon/good_job/pull/154) ([morgoth](https://github.com/morgoth))
|
11
|
+
|
3
12
|
## [v1.2.6](https://github.com/bensheldon/good_job/tree/v1.2.6) (2020-09-29)
|
4
13
|
|
5
14
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v1.2.5...v1.2.6)
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# GoodJob
|
2
2
|
|
3
|
+
[](https://rubygems.org/gems/good_job)
|
4
|
+
[](https://github.com/bensheldon/good_job/actions)
|
5
|
+
|
3
6
|
GoodJob is a multithreaded, Postgres-based, ActiveJob backend for Ruby on Rails.
|
4
7
|
|
5
8
|
**Inspired by [Delayed::Job](https://github.com/collectiveidea/delayed_job) and [Que](https://github.com/que-rb/que), GoodJob is designed for maximum compatibility with Ruby on Rails, ActiveJob, and Postgres to be simple and performant for most workloads.**
|
@@ -210,7 +213,7 @@ Good Job’s general behavior can also be configured via several attributes dire
|
|
210
213
|
|
211
214
|
- **`GoodJob.logger`** ([Rails Logger](https://api.rubyonrails.org/classes/ActiveSupport/Logger.html)) lets you set a custom logger for GoodJob. It should be an instance of a Rails `Logger`.
|
212
215
|
- **`GoodJob.preserve_job_records`** (boolean) keeps job records in your database even after jobs are completed. (Default: `false`)
|
213
|
-
- **`GoodJob.
|
216
|
+
- **`GoodJob.retry_on_unhandled_error`** (boolean) causes jobs to be re-queued and retried if they raise an instance of `StandardError`. Instances of `Exception`, like SIGINT, will *always* be retried, regardless of this attribute’s value. (Default: `true`)
|
214
217
|
- **`GoodJob.on_thread_error`** (proc, lambda, or callable) will be called when an Exception. It can be useful for logging errors to bug tracking services, like Sentry or Airbrake.
|
215
218
|
|
216
219
|
You’ll generally want to configure these in `config/initializers/good_job.rb`, like so:
|
@@ -218,7 +221,7 @@ You’ll generally want to configure these in `config/initializers/good_job.rb`,
|
|
218
221
|
```ruby
|
219
222
|
# config/initializers/good_job.rb
|
220
223
|
GoodJob.preserve_job_records = true
|
221
|
-
GoodJob.
|
224
|
+
GoodJob.retry_on_unhandled_error = false
|
222
225
|
GoodJob.on_thread_error = -> (exception) { Raven.capture_exception(exception) }
|
223
226
|
```
|
224
227
|
|
@@ -301,7 +304,7 @@ When using `retry_on` with _a limited number of retries_, the final exception wi
|
|
301
304
|
|
302
305
|
```ruby
|
303
306
|
# config/initializers/good_job.rb
|
304
|
-
GoodJob.
|
307
|
+
GoodJob.retry_on_unhandled_error = false
|
305
308
|
```
|
306
309
|
|
307
310
|
Alternatively, pass a block to `retry_on` to handle the final exception instead of raising it to GoodJob:
|
data/lib/good_job.rb
CHANGED
@@ -37,14 +37,30 @@ module GoodJob
|
|
37
37
|
# @return [Boolean]
|
38
38
|
mattr_accessor :preserve_job_records, default: false
|
39
39
|
|
40
|
-
# @!attribute [rw]
|
40
|
+
# @!attribute [rw] retry_on_unhandled_error
|
41
41
|
# @!scope class
|
42
42
|
# Whether to re-perform a job when a type of +StandardError+ is raised to GoodJob (default: +true+).
|
43
43
|
# If +true+, causes jobs to be re-queued and retried if they raise an instance of +StandardError+.
|
44
44
|
# If +false+, jobs will be discarded or marked as finished if they raise an instance of +StandardError+.
|
45
45
|
# Instances of +Exception+, like +SIGINT+, will *always* be retried, regardless of this attribute's value.
|
46
46
|
# @return [Boolean]
|
47
|
-
mattr_accessor :
|
47
|
+
mattr_accessor :retry_on_unhandled_error, default: true
|
48
|
+
|
49
|
+
# @deprecated Use {GoodJob#retry_on_unhandled_error} instead.
|
50
|
+
def self.reperform_jobs_on_standard_error
|
51
|
+
ActiveSupport::Deprecation.warn(
|
52
|
+
"Calling 'GoodJob.reperform_jobs_on_standard_error' is deprecated. Please use 'retry_on_unhandled_error'"
|
53
|
+
)
|
54
|
+
retry_on_unhandled_error
|
55
|
+
end
|
56
|
+
|
57
|
+
# @deprecated Use {GoodJob#retry_on_unhandled_error=} instead.
|
58
|
+
def self.reperform_jobs_on_standard_error=(value)
|
59
|
+
ActiveSupport::Deprecation.warn(
|
60
|
+
"Setting 'GoodJob.reperform_jobs_on_standard_error=' is deprecated. Please use 'retry_on_unhandled_error='"
|
61
|
+
)
|
62
|
+
self.retry_on_unhandled_error = value
|
63
|
+
end
|
48
64
|
|
49
65
|
# @!attribute [rw] on_thread_error
|
50
66
|
# @!scope class
|
data/lib/good_job/cli.rb
CHANGED
@@ -42,7 +42,7 @@ module GoodJob
|
|
42
42
|
method_option :poll_interval,
|
43
43
|
type: :numeric,
|
44
44
|
banner: 'SECONDS',
|
45
|
-
desc: "Interval between polls for available jobs in seconds (env var: GOOD_JOB_POLL_INTERVAL, default:
|
45
|
+
desc: "Interval between polls for available jobs in seconds (env var: GOOD_JOB_POLL_INTERVAL, default: 5)"
|
46
46
|
def start
|
47
47
|
set_up_application!
|
48
48
|
|
@@ -8,7 +8,7 @@ module GoodJob
|
|
8
8
|
# Default number of threads to use per {Scheduler}
|
9
9
|
DEFAULT_MAX_THREADS = 5
|
10
10
|
# Default number of seconds between polls for jobs
|
11
|
-
DEFAULT_POLL_INTERVAL =
|
11
|
+
DEFAULT_POLL_INTERVAL = 5
|
12
12
|
# Default number of seconds to preserve jobs for {CLI#cleanup_preserved_jobs}
|
13
13
|
DEFAULT_CLEANUP_PRESERVED_JOBS_BEFORE_SECONDS_AGO = 24 * 60 * 60
|
14
14
|
|
data/lib/good_job/job.rb
CHANGED
@@ -204,7 +204,7 @@ module GoodJob
|
|
204
204
|
|
205
205
|
self.error = "#{job_error.class}: #{job_error.message}" if job_error
|
206
206
|
|
207
|
-
if unhandled_error && GoodJob.
|
207
|
+
if unhandled_error && GoodJob.retry_on_unhandled_error
|
208
208
|
save!
|
209
209
|
elsif GoodJob.preserve_job_records == true || (unhandled_error && GoodJob.preserve_job_records == :on_unhandled_error)
|
210
210
|
self.finished_at = Time.current
|
data/lib/good_job/version.rb
CHANGED
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: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Sheldon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|