good_job 3.19.2 → 3.19.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -1
- data/README.md +26 -2
- data/app/models/good_job/discrete_execution.rb +3 -3
- 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: cb4912917e34844ff32647321159e6c45ea03d962d94b10ee28186cceab9371b
|
4
|
+
data.tar.gz: 1fb418aa9060e1e5781e044fb33ea27be557e1cc171cb82fe78fc1cb345c3e48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad52e1fe639545fcf8d3ef4d3a3e70727493edf397127bda1a68b10535511033620cb7dcc3945c352a1203e765882ac741bf4c4333d9a976f2e9863dc4ce1c11
|
7
|
+
data.tar.gz: 6a6851b391e7651f404ddf42c067d5e2d74380775514799ac159c93f1d63748dc4025fb89e89c1af6f5db8cd14acf3f071dc6354bd3956c8ba7abe0eb29a2674
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v3.19.3](https://github.com/bensheldon/good_job/tree/v3.19.3) (2023-09-28)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.19.2...v3.19.3)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- 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)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Correct `discrete_execution#status` method [\#1092](https://github.com/bensheldon/good_job/pull/1092) ([coreyaus](https://github.com/coreyaus))
|
14
|
+
- Use ActiveSupport::BroadcastLogger [\#1089](https://github.com/bensheldon/good_job/pull/1089) ([bensheldon](https://github.com/bensheldon))
|
15
|
+
- Log thread name for gem development debugging [\#1085](https://github.com/bensheldon/good_job/pull/1085) ([bensheldon](https://github.com/bensheldon))
|
16
|
+
- Describe ApplicationController hook in README [\#1082](https://github.com/bensheldon/good_job/pull/1082) ([maxim](https://github.com/maxim))
|
17
|
+
- \[Docs\] Explain how `priority` works in GoodJob [\#1005](https://github.com/bensheldon/good_job/pull/1005) ([coreyaus](https://github.com/coreyaus))
|
18
|
+
|
3
19
|
## [v3.19.2](https://github.com/bensheldon/good_job/tree/v3.19.2) (2023-09-22)
|
4
20
|
|
5
21
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.19.1...v3.19.2)
|
@@ -1044,7 +1060,7 @@
|
|
1044
1060
|
|
1045
1061
|
- 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
1062
|
- 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) ([
|
1063
|
+
- 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
1064
|
- 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
1065
|
|
1050
1066
|
**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.
|
@@ -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
|
@@ -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.3
|
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-09-
|
11
|
+
date: 2023-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|