good_job 3.7.2 → 3.7.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 +25 -0
- data/README.md +2 -2
- data/app/filters/good_job/base_filter.rb +5 -1
- data/app/filters/good_job/jobs_filter.rb +6 -2
- data/lib/good_job/cleanup_tracker.rb +3 -1
- data/lib/good_job/configuration.rb +59 -16
- 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: 98b02fbefa1bdf43b80628d2995e19295c7051f6ed8d8367c2ddb511fef90aeb
|
4
|
+
data.tar.gz: 92b755dd24a410c0785320c0ca891d4809a286737d46160fc425e3ef8eb42e3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d790addce3a69b2977ce8ab18cd97a2b5ea8f12aade94bead97ff08722ce6245767636450a35dfa76678a0d6f03ddd9a89aa363f338e95d8a45cba05286a9475
|
7
|
+
data.tar.gz: 6c2c63b2aa72b82ef661c4b0edbfd8346d0c30a2a3caac614761686daad00e7dbff1279e2835576615f511e24f14a343521d0300cf90ae16ef4d65d6b6d7b979
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,30 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v3.7.3](https://github.com/bensheldon/good_job/tree/v3.7.3) (2023-01-09)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.7.2...v3.7.3)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Provide clearer values/deprecation notices for `cleanup_interval_jobs` and `cleanup_interval_seconds`; setting `0` disables, `-1` always [\#776](https://github.com/bensheldon/good_job/pull/776) ([zarqman](https://github.com/zarqman))
|
10
|
+
|
11
|
+
**Closed issues:**
|
12
|
+
|
13
|
+
- Demo page shows Application Error [\#787](https://github.com/bensheldon/good_job/issues/787)
|
14
|
+
- Configuration for PG Schema Other Than Public [\#774](https://github.com/bensheldon/good_job/issues/774)
|
15
|
+
|
16
|
+
**Merged pull requests:**
|
17
|
+
|
18
|
+
- Avoid including unnecessary pg\_locks references when counting jobs [\#789](https://github.com/bensheldon/good_job/pull/789) ([mkrfowler](https://github.com/mkrfowler))
|
19
|
+
- Add net-\* gems to Gemfile for Heroku [\#788](https://github.com/bensheldon/good_job/pull/788) ([bensheldon](https://github.com/bensheldon))
|
20
|
+
- Add Ruby 3.2 to test matrix [\#786](https://github.com/bensheldon/good_job/pull/786) ([bensheldon](https://github.com/bensheldon))
|
21
|
+
- Bump rubocop from 1.41.1 to 1.42.0 [\#781](https://github.com/bensheldon/good_job/pull/781) ([dependabot[bot]](https://github.com/apps/dependabot))
|
22
|
+
- Bump rubocop from 1.40.0 to 1.41.1 [\#779](https://github.com/bensheldon/good_job/pull/779) ([dependabot[bot]](https://github.com/apps/dependabot))
|
23
|
+
- Bump rubocop-performance from 1.15.1 to 1.15.2 [\#777](https://github.com/bensheldon/good_job/pull/777) ([dependabot[bot]](https://github.com/apps/dependabot))
|
24
|
+
- Bump rubocop-rspec from 2.15.0 to 2.16.0 [\#775](https://github.com/bensheldon/good_job/pull/775) ([dependabot[bot]](https://github.com/apps/dependabot))
|
25
|
+
- Bump rails-html-sanitizer from 1.4.3 to 1.4.4 [\#773](https://github.com/bensheldon/good_job/pull/773) ([dependabot[bot]](https://github.com/apps/dependabot))
|
26
|
+
- Bump loofah from 2.19.0 to 2.19.1 [\#772](https://github.com/bensheldon/good_job/pull/772) ([dependabot[bot]](https://github.com/apps/dependabot))
|
27
|
+
|
3
28
|
## [v3.7.2](https://github.com/bensheldon/good_job/tree/v3.7.2) (2022-12-12)
|
4
29
|
|
5
30
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.7.1...v3.7.2)
|
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`. Disable with `
|
277
|
-
- `cleanup_interval_seconds` (integer) Number of seconds a Scheduler will wait before cleaning up preserved jobs. Defaults to `600` (10 minutes). Disable with `
|
276
|
+
- `cleanup_interval_jobs` (integer) Number of jobs a Scheduler will execute before cleaning up preserved jobs. Defaults to `1000`. Disable with `false`. Can also be set with the environment variable `GOOD_JOB_CLEANUP_INTERVAL_JOBS` and disabled with `0`).
|
277
|
+
- `cleanup_interval_seconds` (integer) Number of seconds a Scheduler will wait before cleaning up preserved jobs. Defaults to `600` (10 minutes). Disable with `false`. Can also be set with the environment variable `GOOD_JOB_CLEANUP_INTERVAL_SECONDS` and disabled with `0`).
|
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`)
|
@@ -14,7 +14,7 @@ module GoodJob
|
|
14
14
|
def records
|
15
15
|
after_scheduled_at = params[:after_scheduled_at].present? ? Time.zone.parse(params[:after_scheduled_at]) : nil
|
16
16
|
|
17
|
-
|
17
|
+
query_for_records.display_all(
|
18
18
|
after_scheduled_at: after_scheduled_at,
|
19
19
|
after_id: params[:after_id]
|
20
20
|
).limit(params.fetch(:limit, DEFAULT_LIMIT))
|
@@ -62,6 +62,10 @@ module GoodJob
|
|
62
62
|
|
63
63
|
private
|
64
64
|
|
65
|
+
def query_for_records
|
66
|
+
raise NotImplementedError
|
67
|
+
end
|
68
|
+
|
65
69
|
def default_base_query
|
66
70
|
raise NotImplementedError
|
67
71
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
module GoodJob
|
3
3
|
class JobsFilter < BaseFilter
|
4
4
|
def states
|
5
|
-
query = filtered_query(params.except(:state))
|
5
|
+
query = filtered_query(params.except(:state))
|
6
6
|
{
|
7
7
|
'scheduled' => query.scheduled.count,
|
8
8
|
'retried' => query.retried.count,
|
@@ -14,7 +14,7 @@ module GoodJob
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def filtered_query(filter_params = params)
|
17
|
-
query = base_query
|
17
|
+
query = base_query
|
18
18
|
|
19
19
|
query = query.job_class(filter_params[:job_class]) if filter_params[:job_class].present?
|
20
20
|
query = query.where(queue_name: filter_params[:queue_name]) if filter_params[:queue_name].present?
|
@@ -47,6 +47,10 @@ module GoodJob
|
|
47
47
|
|
48
48
|
private
|
49
49
|
|
50
|
+
def query_for_records
|
51
|
+
filtered_query.includes(:executions).includes_advisory_locks
|
52
|
+
end
|
53
|
+
|
50
54
|
def default_base_query
|
51
55
|
GoodJob::Job.all
|
52
56
|
end
|
@@ -7,7 +7,9 @@ module GoodJob # :nodoc:
|
|
7
7
|
:job_count,
|
8
8
|
:last_at
|
9
9
|
|
10
|
-
def initialize(cleanup_interval_seconds:
|
10
|
+
def initialize(cleanup_interval_seconds: false, cleanup_interval_jobs: false)
|
11
|
+
raise ArgumentError, "Do not use `0`. Use `false` to disable, or -1 to always run" if cleanup_interval_seconds == 0 || cleanup_interval_jobs == 0 # rubocop:disable Style/NumericPredicate
|
12
|
+
|
11
13
|
self.cleanup_interval_seconds = cleanup_interval_seconds
|
12
14
|
self.cleanup_interval_jobs = cleanup_interval_jobs
|
13
15
|
|
@@ -242,29 +242,72 @@ module GoodJob
|
|
242
242
|
end
|
243
243
|
|
244
244
|
# Number of jobs a {Scheduler} will execute before automatically cleaning up preserved jobs.
|
245
|
+
# Positive values will clean up after that many jobs have run, false or 0 will disable, and -1 will clean up after every job.
|
245
246
|
# @return [Integer, nil]
|
246
247
|
def cleanup_interval_jobs
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
248
|
+
if rails_config.key?(:cleanup_interval_jobs)
|
249
|
+
value = rails_config[:cleanup_interval_jobs]
|
250
|
+
if value.nil?
|
251
|
+
ActiveSupport::Deprecation.warn(
|
252
|
+
%(Setting `config.good_job.cleanup_interval_jobs` to `nil` will no longer disable count-based cleanups in GoodJob v4. Set to `false` to disable, or `-1` to run every time.)
|
253
|
+
)
|
254
|
+
value = false
|
255
|
+
elsif value == 0 # rubocop:disable Style/NumericPredicate
|
256
|
+
ActiveSupport::Deprecation.warn(
|
257
|
+
%(Setting `config.good_job.cleanup_interval_jobs` to `0` will disable count-based cleanups in GoodJob v4. Set to `false` to disable, or `-1` to run every time.)
|
258
|
+
)
|
259
|
+
value = -1
|
260
|
+
end
|
261
|
+
elsif env.key?('GOOD_JOB_CLEANUP_INTERVAL_JOBS')
|
262
|
+
value = env['GOOD_JOB_CLEANUP_INTERVAL_JOBS']
|
263
|
+
if value.blank?
|
264
|
+
ActiveSupport::Deprecation.warn(
|
265
|
+
%(Setting `GOOD_JOB_CLEANUP_INTERVAL_JOBS` to `""` will no longer disable count-based cleanups in GoodJob v4. Set to `0` to disable, or `-1` to run every time.)
|
266
|
+
)
|
267
|
+
value = false
|
268
|
+
elsif value == '0'
|
269
|
+
value = false
|
270
|
+
end
|
271
|
+
else
|
272
|
+
value = DEFAULT_CLEANUP_INTERVAL_JOBS
|
273
|
+
end
|
274
|
+
|
275
|
+
value ? value.to_i : false
|
255
276
|
end
|
256
277
|
|
257
278
|
# Number of seconds a {Scheduler} will wait before automatically cleaning up preserved jobs.
|
279
|
+
# Positive values will clean up after that many jobs have run, false or 0 will disable, and -1 will clean up after every job.
|
258
280
|
# @return [Integer, nil]
|
259
281
|
def cleanup_interval_seconds
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
282
|
+
if rails_config.key?(:cleanup_interval_seconds)
|
283
|
+
value = rails_config[:cleanup_interval_seconds]
|
284
|
+
|
285
|
+
if value.nil?
|
286
|
+
ActiveSupport::Deprecation.warn(
|
287
|
+
%(Setting `config.good_job.cleanup_interval_seconds` to `nil` will no longer disable time-based cleanups in GoodJob v4. Set to `false` to disable, or `-1` to run every time.)
|
288
|
+
)
|
289
|
+
value = false
|
290
|
+
elsif value == 0 # rubocop:disable Style/NumericPredicate
|
291
|
+
ActiveSupport::Deprecation.warn(
|
292
|
+
%(Setting `config.good_job.cleanup_interval_seconds` to `0` will disable time-based cleanups in GoodJob v4. Set to `false` to disable, or `-1` to run every time.)
|
293
|
+
)
|
294
|
+
value = -1
|
295
|
+
end
|
296
|
+
elsif env.key?('GOOD_JOB_CLEANUP_INTERVAL_SECONDS')
|
297
|
+
value = env['GOOD_JOB_CLEANUP_INTERVAL_SECONDS']
|
298
|
+
if value.blank?
|
299
|
+
ActiveSupport::Deprecation.warn(
|
300
|
+
%(Setting `GOOD_JOB_CLEANUP_INTERVAL_SECONDS` to `""` will no longer disable time-based cleanups in GoodJob v4. Set to `0` to disable, or `-1` to run every time.)
|
301
|
+
)
|
302
|
+
value = false
|
303
|
+
elsif value == '0'
|
304
|
+
value = false
|
305
|
+
end
|
306
|
+
else
|
307
|
+
value = DEFAULT_CLEANUP_INTERVAL_SECONDS
|
308
|
+
end
|
309
|
+
|
310
|
+
value ? value.to_i : false
|
268
311
|
end
|
269
312
|
|
270
313
|
# Tests whether to daemonize the process.
|
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.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:
|
11
|
+
date: 2023-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|