good_job 3.7.0 → 3.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66b60bc23382c00854b271e6de89adaa7d488b41bc1dc172ffe9411ceb1c5211
4
- data.tar.gz: 80ed47811e016b45e3bb9f2c18cd0f3225e743d6f9e2b9b3cec8c7ab8efef782
3
+ metadata.gz: 79ee8980f9408a7e530f6dbc4037f742033e3dbe9919442f08e854314730ef31
4
+ data.tar.gz: bf17a0b7e1fe8cb4d4f7bdfd20b333e2f9e1ce67504e34a9195e1e0921827284
5
5
  SHA512:
6
- metadata.gz: 6c066709c1b40fc84651809540e08350128b563e5f5392d3dec694ad619a9271c0546e2e248ef3135e524b94a998488600544784461015762f461039fe664ce3
7
- data.tar.gz: 1e795fbd067f2e38f141ee473652a7f9394ef1369b338fd4ef44df7f307e08334056c651325bd1ffdab701c2445fab62db0256809f34cc6ad7b9ed9834fefbbc
6
+ metadata.gz: 955afa8f3f3a224afb58824525a1b230abecbdbfd395e4e31a8dad5498fb32618c77d1e3c70a1503a3228c8e8ea3bdfdb4dccb9238ff0554ad43005e325a64c5
7
+ data.tar.gz: '029ba620af1d42c78b5b0d61524ac5338f501383b7ed166ff559cff4f0505a81485bef07b8aa04179ab17ab9fa6fca96a84b2a61694e7da18832b365fde8e1a1'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.7.1](https://github.com/bensheldon/good_job/tree/v3.7.1) (2022-12-12)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.7.0...v3.7.1)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Fix disabling of interval cleanups [\#768](https://github.com/bensheldon/good_job/pull/768) ([zarqman](https://github.com/zarqman))
10
+
3
11
  ## [v3.7.0](https://github.com/bensheldon/good_job/tree/v3.7.0) (2022-12-10)
4
12
 
5
13
  [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.to_i
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.to_i # Number of seconds between deletion sweeps.
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:
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: 86400)"
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
- rails_config[:cleanup_interval_jobs] ||
249
- env['GOOD_JOB_CLEANUP_INTERVAL_JOBS'] ||
250
- DEFAULT_CLEANUP_INTERVAL_JOBS
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
- rails_config[:cleanup_interval_seconds] ||
260
- env['GOOD_JOB_CLEANUP_INTERVAL_SECONDS'] ||
261
- DEFAULT_CLEANUP_INTERVAL_SECONDS
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module GoodJob
3
3
  # GoodJob gem version.
4
- VERSION = '3.7.0'
4
+ VERSION = '3.7.1'
5
5
  end
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.0
4
+ version: 3.7.1
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-10 00:00:00.000000000 Z
11
+ date: 2022-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob