good_job 3.19.2 → 3.19.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -1
- data/README.md +27 -3
- data/app/models/good_job/discrete_execution.rb +3 -3
- data/lib/good_job/active_job_extensions/concurrency.rb +7 -1
- data/lib/good_job/log_subscriber.rb +9 -7
- 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: 7b2fd15bbee1a5d3cbe17a0154fa15fdd960c9b5fc39a55b60831792095538e0
|
4
|
+
data.tar.gz: 831a78bc9a7e569fb72601f817bb4397b702ad89dc4f1e5776b3c8fc28ab042e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c598627e0a4999e7faef09edb7c286344019a4c20fb7cf952bf0026a2247aa1f4aef4f9e9530e8cc105ec502cbf258f41f58ad5a1ec62ce7e2453f8dd4f0f92c
|
7
|
+
data.tar.gz: 40dfbac0623a460c22f55889cd80bccc77a7391c3c05b42692267424c136af3224d20d042735906dca506540a699a5f7a592d8eda16ff79255089fc15b390829
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,34 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v3.19.4](https://github.com/bensheldon/good_job/tree/v3.19.4) (2023-10-04)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.19.3...v3.19.4)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- Including GoodJob::ActiveJobExtensions::Concurrency triggers rails deprecation notice [\#1096](https://github.com/bensheldon/good_job/issues/1096)
|
10
|
+
- Add retries exhaused callback [\#1080](https://github.com/bensheldon/good_job/issues/1080)
|
11
|
+
|
12
|
+
**Merged pull requests:**
|
13
|
+
|
14
|
+
- Address rails 7.1 deprecation when using `ActiveJobExtensions::Concurrency` [\#1097](https://github.com/bensheldon/good_job/pull/1097) ([Earlopain](https://github.com/Earlopain))
|
15
|
+
|
16
|
+
## [v3.19.3](https://github.com/bensheldon/good_job/tree/v3.19.3) (2023-09-28)
|
17
|
+
|
18
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.19.2...v3.19.3)
|
19
|
+
|
20
|
+
**Closed issues:**
|
21
|
+
|
22
|
+
- Explicitly write that jobs with higher priority jobs run first \(unlike Que or DelayedJob\) at readme. [\#991](https://github.com/bensheldon/good_job/issues/991)
|
23
|
+
|
24
|
+
**Merged pull requests:**
|
25
|
+
|
26
|
+
- Correct `discrete_execution#status` method [\#1092](https://github.com/bensheldon/good_job/pull/1092) ([coreyaus](https://github.com/coreyaus))
|
27
|
+
- Use ActiveSupport::BroadcastLogger [\#1089](https://github.com/bensheldon/good_job/pull/1089) ([bensheldon](https://github.com/bensheldon))
|
28
|
+
- Log thread name for gem development debugging [\#1085](https://github.com/bensheldon/good_job/pull/1085) ([bensheldon](https://github.com/bensheldon))
|
29
|
+
- Describe ApplicationController hook in README [\#1082](https://github.com/bensheldon/good_job/pull/1082) ([maxim](https://github.com/maxim))
|
30
|
+
- \[Docs\] Explain how `priority` works in GoodJob [\#1005](https://github.com/bensheldon/good_job/pull/1005) ([coreyaus](https://github.com/coreyaus))
|
31
|
+
|
3
32
|
## [v3.19.2](https://github.com/bensheldon/good_job/tree/v3.19.2) (2023-09-22)
|
4
33
|
|
5
34
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.19.1...v3.19.2)
|
@@ -1044,7 +1073,7 @@
|
|
1044
1073
|
|
1045
1074
|
- Add cron\_enabled attribute to good\_job and pass it to process current state [\#675](https://github.com/bensheldon/good_job/pull/675) ([saksham-jain](https://github.com/saksham-jain))
|
1046
1075
|
- Reverse Dashboard Filter Hierarchy to be: queues+jobs then state [\#666](https://github.com/bensheldon/good_job/pull/666) ([bensheldon](https://github.com/bensheldon))
|
1047
|
-
- Allow cron entries to be temporarily disabled and re-enabled through the Dashboard [\#649](https://github.com/bensheldon/good_job/pull/649) ([
|
1076
|
+
- Allow cron entries to be temporarily disabled and re-enabled through the Dashboard [\#649](https://github.com/bensheldon/good_job/pull/649) ([sasha-id](https://github.com/sasha-id))
|
1048
1077
|
- Add Configuration.total\_estimated\_threads to report number of threads consumed by GoodJob [\#645](https://github.com/bensheldon/good_job/pull/645) ([bensheldon](https://github.com/bensheldon))
|
1049
1078
|
|
1050
1079
|
**Closed issues:**
|
data/README.md
CHANGED
@@ -40,7 +40,8 @@ For more of the story of GoodJob, read the [introductory blog post](https://isla
|
|
40
40
|
- [Global options](#global-options)
|
41
41
|
- [Dashboard](#dashboard)
|
42
42
|
- [API-only Rails applications](#api-only-rails-applications)
|
43
|
-
- [Live
|
43
|
+
- [Live polling](#live-polling)
|
44
|
+
- [Job priority](#job-priority)
|
44
45
|
- [Concurrency controls](#concurrency-controls)
|
45
46
|
- [How concurrency controls work](#how-concurrency-controls-work)
|
46
47
|
- [Cron-style repeating/recurring jobs](#cron-style-repeatingrecurring-jobs)
|
@@ -290,6 +291,7 @@ Available configuration options are:
|
|
290
291
|
- `inline_execution_respects_schedule` (boolean) Opt-in to future behavior of inline execution respecting scheduled jobs. Defaults to `false`.
|
291
292
|
- `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` (Default: `Rails.logger`).
|
292
293
|
- `preserve_job_records` (boolean) keeps job records in your database even after jobs are completed. (Default: `true`)
|
294
|
+
- `smaller_number_is_higher_priority` (boolean) allows you to specifiy that jobs should be run in ascending order of priority (smallest priority numbers first). This will be enabled by default in the next major version of GoodJob (v4.0), but jobs with the highest priority number are run first by default in all earlier versions of GoodJob.
|
293
295
|
- `retry_on_unhandled_error` (boolean) causes jobs to be re-queued and retried if they raise an instance of `StandardError`. Be advised this may lead to jobs being repeated infinitely ([see below for more on retries](#retries)). Instances of `Exception`, like SIGINT, will *always* be retried, regardless of this attribute’s value. (Default: `false`)
|
294
296
|
- `on_thread_error` (proc, lambda, or callable) will be called when there is an Exception. It can be useful for logging errors to bug tracking services, like Sentry or Airbrake. Example:
|
295
297
|
|
@@ -380,6 +382,24 @@ GoodJob includes a Dashboard as a mountable `Rails::Engine`.
|
|
380
382
|
end
|
381
383
|
```
|
382
384
|
|
385
|
+
To support custom authentication, you can extend GoodJob's `ApplicationController` using the following hook:
|
386
|
+
|
387
|
+
```ruby
|
388
|
+
# config/initializers/good_job.rb
|
389
|
+
|
390
|
+
ActiveSupport.on_load(:good_job_application_controller) do
|
391
|
+
# context here is GoodJob::ApplicationController
|
392
|
+
|
393
|
+
before_action do
|
394
|
+
raise ActionController::RoutingError.new('Not Found') unless current_user&.admin?
|
395
|
+
end
|
396
|
+
|
397
|
+
def current_user
|
398
|
+
# load current user
|
399
|
+
end
|
400
|
+
end
|
401
|
+
```
|
402
|
+
|
383
403
|
_To view finished jobs (succeeded and discarded) on the Dashboard, GoodJob must be configured to preserve job records. Preservation is enabled by default._
|
384
404
|
|
385
405
|
**Troubleshooting the Dashboard:** Some applications are unable to autoload the Goodjob Engine. To work around this, explicitly require the Engine at the top of your `config/application.rb` file, immediately after Rails is required and before Bundler requires the Rails' groups.
|
@@ -409,10 +429,14 @@ module MyApp
|
|
409
429
|
end
|
410
430
|
```
|
411
431
|
|
412
|
-
#### Live
|
432
|
+
#### Live polling
|
413
433
|
|
414
434
|
The Dashboard can be set to automatically refresh by checking "Live Poll" in the Dashboard header, or by setting `?poll=10` with the interval in seconds (default 30 seconds).
|
415
435
|
|
436
|
+
### Job priority
|
437
|
+
|
438
|
+
Higher priority numbers run first in all versions of GoodJob v3.x and below. GoodJob v4.x will change job `priority` to give smaller numbers higher priority (default: `0`), in accordance with Active Job's definition of priority (see #524). To opt-in to this behavior now, set `config.good_job.smaller_number_is_higher_priority = true` in your GoodJob initializer or `application.rb`.
|
439
|
+
|
416
440
|
### Concurrency controls
|
417
441
|
|
418
442
|
GoodJob can extend ActiveJob to provide limits on concurrently running jobs, either at time of _enqueue_ or at _perform_. Limiting concurrency can help prevent duplicate, double or unnecessary jobs from being enqueued, or race conditions when performing, for example when interacting with 3rd-party APIs.
|
@@ -792,7 +816,7 @@ GoodJob.on_thread_error = -> (exception) { Rails.error.report(exception) }
|
|
792
816
|
|
793
817
|
By default, GoodJob relies on ActiveJob's retry functionality.
|
794
818
|
|
795
|
-
ActiveJob can be configured to retry an infinite number of times, with
|
819
|
+
ActiveJob can be configured to retry an infinite number of times, with a polynomial backoff. Using ActiveJob's `retry_on` prevents exceptions from reaching GoodJob:
|
796
820
|
|
797
821
|
```ruby
|
798
822
|
class ApplicationJob < ActiveJob::Base
|
@@ -40,10 +40,10 @@ module GoodJob # :nodoc:
|
|
40
40
|
|
41
41
|
def status
|
42
42
|
if finished_at.present?
|
43
|
-
if error.present?
|
44
|
-
:retried
|
45
|
-
elsif error.present? && job.finished_at.present?
|
43
|
+
if error.present? && job.finished_at.present?
|
46
44
|
:discarded
|
45
|
+
elsif error.present?
|
46
|
+
:retried
|
47
47
|
else
|
48
48
|
:succeeded
|
49
49
|
end
|
@@ -36,10 +36,16 @@ module GoodJob
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
wait_key = if ActiveJob.gem_version >= Gem::Version.new("7.1.0.a")
|
40
|
+
:polynomially_longer
|
41
|
+
else
|
42
|
+
:exponentially_longer
|
43
|
+
end
|
44
|
+
|
39
45
|
retry_on(
|
40
46
|
GoodJob::ActiveJobExtensions::Concurrency::ConcurrencyExceededError,
|
41
47
|
attempts: Float::INFINITY,
|
42
|
-
wait:
|
48
|
+
wait: wait_key
|
43
49
|
)
|
44
50
|
|
45
51
|
before_perform do |job|
|
@@ -208,13 +208,15 @@ module GoodJob
|
|
208
208
|
# each of the loggers in {LogSubscriber.loggers}.
|
209
209
|
# @return [Logger]
|
210
210
|
def logger
|
211
|
-
@_logger ||=
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
211
|
+
@_logger ||= if defined?(ActiveSupport::BroadcastLogger)
|
212
|
+
ActiveSupport::BroadcastLogger.new(*loggers)
|
213
|
+
else
|
214
|
+
logger = Logger.new(StringIO.new)
|
215
|
+
loggers.each do |each_logger|
|
216
|
+
logger.extend(ActiveSupport::Logger.broadcast(each_logger))
|
217
|
+
end
|
218
|
+
logger
|
219
|
+
end
|
218
220
|
end
|
219
221
|
|
220
222
|
# Reset {LogSubscriber.logger} and force it to rebuild a new shortcut to
|
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: 3.19.
|
4
|
+
version: 3.19.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Sheldon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|