good_job 3.7.0 → 3.7.2
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 +21 -0
- data/README.md +4 -4
- data/app/models/good_job/execution.rb +8 -1
- data/app/models/good_job/job.rb +1 -1
- data/lib/good_job/cli.rb +1 -1
- data/lib/good_job/configuration.rb +14 -10
- 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: 820584e338535d72bf53a7e41718998ee39f718a9b77bc20a5a382b4deb7a8d0
|
|
4
|
+
data.tar.gz: a9a8285fce5d8a7345ce22903f24dafc9217dc853a93161fad6e7df1efede5b4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4a52184bd60ba084f42949096149c5b85defa7db032b61aedb3204d125cbc0a84d8d39dcba6316c49ad7f0a6e23c41109b12fd9f3dc9d1df2eeb86b7c12c3268
|
|
7
|
+
data.tar.gz: 54868876aefebb9668ee83b900b123c5ce512bd6b805cd6f005dbb9a60573b947b42d559ae1608b624dd21a4f70a8379ba3ad1eacc1f2f293ec3925c77fed913
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v3.7.2](https://github.com/bensheldon/good_job/tree/v3.7.2) (2022-12-12)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.7.1...v3.7.2)
|
|
6
|
+
|
|
7
|
+
**Closed issues:**
|
|
8
|
+
|
|
9
|
+
- Unable to discard failed jobs which crashed with `ActiveJob::DeserializationError` [\#770](https://github.com/bensheldon/good_job/issues/770)
|
|
10
|
+
|
|
11
|
+
**Merged pull requests:**
|
|
12
|
+
|
|
13
|
+
- Ignore ActiveJob::DeserializationError when discarding jobs [\#771](https://github.com/bensheldon/good_job/pull/771) ([nickcampbell18](https://github.com/nickcampbell18))
|
|
14
|
+
- Bump rubocop from 1.39.0 to 1.40.0 [\#769](https://github.com/bensheldon/good_job/pull/769) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
15
|
+
|
|
16
|
+
## [v3.7.1](https://github.com/bensheldon/good_job/tree/v3.7.1) (2022-12-12)
|
|
17
|
+
|
|
18
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.7.0...v3.7.1)
|
|
19
|
+
|
|
20
|
+
**Fixed bugs:**
|
|
21
|
+
|
|
22
|
+
- Fix disabling of interval cleanups [\#768](https://github.com/bensheldon/good_job/pull/768) ([zarqman](https://github.com/zarqman))
|
|
23
|
+
|
|
3
24
|
## [v3.7.0](https://github.com/bensheldon/good_job/tree/v3.7.0) (2022-12-10)
|
|
4
25
|
|
|
5
26
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.6.2...v3.7.0)
|
data/README.md
CHANGED
|
@@ -273,8 +273,8 @@ Available configuration options are:
|
|
|
273
273
|
- `cron` (hash) cron configuration. Defaults to `{}`. You can also set this as a JSON string with the environment variable `GOOD_JOB_CRON`
|
|
274
274
|
- `cleanup_discarded_jobs` (boolean) whether to destroy discarded jobs when cleaning up preserved jobs using the `$ good_job cleanup_preserved_jobs` CLI command or calling `GoodJob.cleanup_preserved_jobs`. Defaults to `true`. Can also be set with the environment variable `GOOD_JOB_CLEANUP_DISCARDED_JOBS`. _This configuration is only used when {GoodJob.preserve_job_records} is `true`._
|
|
275
275
|
- `cleanup_preserved_jobs_before_seconds_ago` (integer) number of seconds to preserve jobs when using the `$ good_job cleanup_preserved_jobs` CLI command or calling `GoodJob.cleanup_preserved_jobs`. Defaults to `1209600` (14 days). Can also be set with the environment variable `GOOD_JOB_CLEANUP_PRESERVED_JOBS_BEFORE_SECONDS_AGO`. _This configuration is only used when {GoodJob.preserve_job_records} is `true`._
|
|
276
|
-
- `cleanup_interval_jobs` (integer) Number of jobs a Scheduler will execute before cleaning up preserved jobs. Defaults to `1000`. Can also be set with the environment variable `GOOD_JOB_CLEANUP_INTERVAL_JOBS`.
|
|
277
|
-
- `cleanup_interval_seconds` (integer) Number of seconds a Scheduler will wait before cleaning up preserved jobs. Defaults to `600` (10 minutes). Can also be set with the environment variable `GOOD_JOB_CLEANUP_INTERVAL_SECONDS`.
|
|
276
|
+
- `cleanup_interval_jobs` (integer) Number of jobs a Scheduler will execute before cleaning up preserved jobs. Defaults to `1000`. Disable with `nil`. Can also be set with the environment variable `GOOD_JOB_CLEANUP_INTERVAL_JOBS`.
|
|
277
|
+
- `cleanup_interval_seconds` (integer) Number of seconds a Scheduler will wait before cleaning up preserved jobs. Defaults to `600` (10 minutes). Disable with `nil`. Can also be set with the environment variable `GOOD_JOB_CLEANUP_INTERVAL_SECONDS`.
|
|
278
278
|
- `inline_execution_respects_schedule` (boolean) Opt-in to future behavior of inline execution respecting scheduled jobs. Defaults to `false`.
|
|
279
279
|
- `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`).
|
|
280
280
|
- `preserve_job_records` (boolean) keeps job records in your database even after jobs are completed. (Default: `true`)
|
|
@@ -926,9 +926,9 @@ config.good_job.preserve_job_records = false # defaults to true; can also be `fa
|
|
|
926
926
|
GoodJob will automatically delete preserved job records after 14 days. The retention period, as well as the frequency GoodJob checks for deletable records can be configured:
|
|
927
927
|
|
|
928
928
|
```ruby
|
|
929
|
-
config.good_job.cleanup_preserved_jobs_before_seconds_ago = 14.days
|
|
929
|
+
config.good_job.cleanup_preserved_jobs_before_seconds_ago = 14.days
|
|
930
930
|
config.good_job.cleanup_interval_jobs = 1_000 # Number of executed jobs between deletion sweeps.
|
|
931
|
-
config.good_job.cleanup_interval_seconds = 10.minutes
|
|
931
|
+
config.good_job.cleanup_interval_seconds = 10.minutes # Number of seconds between deletion sweeps.
|
|
932
932
|
```
|
|
933
933
|
|
|
934
934
|
It is also possible to manually trigger a cleanup of preserved job records:
|
|
@@ -316,9 +316,16 @@ module GoodJob
|
|
|
316
316
|
self.class.unscoped.unfinished.owns_advisory_locked.exists?(id: id)
|
|
317
317
|
end
|
|
318
318
|
|
|
319
|
-
|
|
319
|
+
# Build an ActiveJob instance and deserialize the arguments, using `#active_job_data`.
|
|
320
|
+
#
|
|
321
|
+
# @param ignore_deserialization_errors [Boolean]
|
|
322
|
+
# Whether to ignore ActiveJob::DeserializationError when deserializing the arguments.
|
|
323
|
+
# This is most useful if you aren't planning to use the arguments directly.
|
|
324
|
+
def active_job(ignore_deserialization_errors: false)
|
|
320
325
|
ActiveJob::Base.deserialize(active_job_data).tap do |aj|
|
|
321
326
|
aj.send(:deserialize_arguments_if_needed)
|
|
327
|
+
rescue ActiveJob::DeserializationError
|
|
328
|
+
raise unless ignore_deserialization_errors
|
|
322
329
|
end
|
|
323
330
|
end
|
|
324
331
|
|
data/app/models/good_job/job.rb
CHANGED
|
@@ -206,7 +206,7 @@ module GoodJob
|
|
|
206
206
|
def discard_job(message)
|
|
207
207
|
with_advisory_lock do
|
|
208
208
|
execution = head_execution(reload: true)
|
|
209
|
-
active_job = execution.active_job
|
|
209
|
+
active_job = execution.active_job(ignore_deserialization_errors: true)
|
|
210
210
|
|
|
211
211
|
raise ActionForStateMismatchError if execution.finished_at.present?
|
|
212
212
|
|
data/lib/good_job/cli.rb
CHANGED
|
@@ -137,7 +137,7 @@ module GoodJob
|
|
|
137
137
|
method_option :before_seconds_ago,
|
|
138
138
|
type: :numeric,
|
|
139
139
|
banner: 'SECONDS',
|
|
140
|
-
desc: "Destroy records finished more than this many seconds ago (env var: GOOD_JOB_CLEANUP_PRESERVED_JOBS_BEFORE_SECONDS_AGO, default:
|
|
140
|
+
desc: "Destroy records finished more than this many seconds ago (env var: GOOD_JOB_CLEANUP_PRESERVED_JOBS_BEFORE_SECONDS_AGO, default: 1209600 (14 days))"
|
|
141
141
|
|
|
142
142
|
def cleanup_preserved_jobs
|
|
143
143
|
set_up_application!
|
|
@@ -244,22 +244,26 @@ module GoodJob
|
|
|
244
244
|
# Number of jobs a {Scheduler} will execute before automatically cleaning up preserved jobs.
|
|
245
245
|
# @return [Integer, nil]
|
|
246
246
|
def cleanup_interval_jobs
|
|
247
|
-
value = (
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
247
|
+
value = if rails_config.key?(:cleanup_interval_jobs)
|
|
248
|
+
rails_config[:cleanup_interval_jobs]
|
|
249
|
+
elsif env.key?('GOOD_JOB_CLEANUP_INTERVAL_JOBS')
|
|
250
|
+
env['GOOD_JOB_CLEANUP_INTERVAL_JOBS']
|
|
251
|
+
else
|
|
252
|
+
DEFAULT_CLEANUP_INTERVAL_JOBS
|
|
253
|
+
end
|
|
252
254
|
value.present? ? value.to_i : nil
|
|
253
255
|
end
|
|
254
256
|
|
|
255
257
|
# Number of seconds a {Scheduler} will wait before automatically cleaning up preserved jobs.
|
|
256
258
|
# @return [Integer, nil]
|
|
257
259
|
def cleanup_interval_seconds
|
|
258
|
-
value = (
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
260
|
+
value = if rails_config.key?(:cleanup_interval_seconds)
|
|
261
|
+
rails_config[:cleanup_interval_seconds]
|
|
262
|
+
elsif env.key?('GOOD_JOB_CLEANUP_INTERVAL_SECONDS')
|
|
263
|
+
env['GOOD_JOB_CLEANUP_INTERVAL_SECONDS']
|
|
264
|
+
else
|
|
265
|
+
DEFAULT_CLEANUP_INTERVAL_SECONDS
|
|
266
|
+
end
|
|
263
267
|
value.present? ? value.to_i : nil
|
|
264
268
|
end
|
|
265
269
|
|
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.7.
|
|
4
|
+
version: 3.7.2
|
|
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-12-
|
|
11
|
+
date: 2022-12-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activejob
|