good_job 3.6.2 → 3.7.0

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: 2bcf55b958dd5e2d0c0711ff1d1a52e94daa21a0f54c96e264934be70f4eb71a
4
- data.tar.gz: bafd6907fd2f9ed5bf41b04b0d3f844407c85de9b488f6c0715413a77134ef27
3
+ metadata.gz: 66b60bc23382c00854b271e6de89adaa7d488b41bc1dc172ffe9411ceb1c5211
4
+ data.tar.gz: 80ed47811e016b45e3bb9f2c18cd0f3225e743d6f9e2b9b3cec8c7ab8efef782
5
5
  SHA512:
6
- metadata.gz: 34ea4a118657a0ea9fb43ef82e6d01fc275269bb8d172d9a6baa4db30af141faf90256e350a77fe09bb821cfdf51c4efe0416576576809b377ed68a4408cc339
7
- data.tar.gz: 96f8567cbd0c52742dd5e60046c8e81d249de5a78a6a7f3dde1f0185316407e965f060275bcfce2fc902df3c27ae83124d37351f241dba7241443c652a168837
6
+ metadata.gz: 6c066709c1b40fc84651809540e08350128b563e5f5392d3dec694ad619a9271c0546e2e248ef3135e524b94a998488600544784461015762f461039fe664ce3
7
+ data.tar.gz: 1e795fbd067f2e38f141ee473652a7f9394ef1369b338fd4ef44df7f307e08334056c651325bd1ffdab701c2445fab62db0256809f34cc6ad7b9ed9834fefbbc
data/CHANGELOG.md CHANGED
@@ -1,12 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.7.0](https://github.com/bensheldon/good_job/tree/v3.7.0) (2022-12-10)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.6.2...v3.7.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Add GoodJob version to start banner [\#766](https://github.com/bensheldon/good_job/pull/766) ([zarqman](https://github.com/zarqman))
10
+
11
+ **Fixed bugs:**
12
+
13
+ - Always preserve job records created by cron [\#767](https://github.com/bensheldon/good_job/pull/767) ([bensheldon](https://github.com/bensheldon))
14
+
15
+ **Merged pull requests:**
16
+
17
+ - Bump nokogiri from 1.13.9 to 1.13.10 [\#765](https://github.com/bensheldon/good_job/pull/765) ([dependabot[bot]](https://github.com/apps/dependabot))
18
+ - Remove JRuby 9.2 from testing matrix [\#763](https://github.com/bensheldon/good_job/pull/763) ([bensheldon](https://github.com/bensheldon))
19
+ - Bump actions/cache from 1 to 3 [\#762](https://github.com/bensheldon/good_job/pull/762) ([dependabot[bot]](https://github.com/apps/dependabot))
20
+ - Bump actions/upload-artifact from 2 to 3 [\#761](https://github.com/bensheldon/good_job/pull/761) ([dependabot[bot]](https://github.com/apps/dependabot))
21
+ - Bump actions/add-to-project from 0.3.0 to 0.4.0 [\#759](https://github.com/bensheldon/good_job/pull/759) ([dependabot[bot]](https://github.com/apps/dependabot))
22
+ - Bump alex-page/github-project-automation-plus from 9a05133789dbc96bd560ec84223a0ad49253d342 to 1f8873e97e3c8f58161a323b7c568c1f623a1c4d [\#758](https://github.com/bensheldon/good_job/pull/758) ([dependabot[bot]](https://github.com/apps/dependabot))
23
+ - Bump selenium-webdriver from 4.6.1 to 4.7.1 [\#757](https://github.com/bensheldon/good_job/pull/757) ([dependabot[bot]](https://github.com/apps/dependabot))
24
+ - Add explicit ruby version in Gemfile for Heroku demo [\#755](https://github.com/bensheldon/good_job/pull/755) ([bensheldon](https://github.com/bensheldon))
25
+
3
26
  ## [v3.6.2](https://github.com/bensheldon/good_job/tree/v3.6.2) (2022-12-04)
4
27
 
5
28
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.6.1...v3.6.2)
6
29
 
7
- **Merged pull requests:**
30
+ **Fixed bugs:**
8
31
 
9
32
  - Redirect to Jobs path after destroy [\#754](https://github.com/bensheldon/good_job/pull/754) ([BilalBudhani](https://github.com/BilalBudhani))
33
+
34
+ **Merged pull requests:**
35
+
10
36
  - Bump pg from 1.4.4 to 1.4.5 [\#751](https://github.com/bensheldon/good_job/pull/751) ([dependabot[bot]](https://github.com/apps/dependabot))
11
37
 
12
38
  ## [v3.6.1](https://github.com/bensheldon/good_job/tree/v3.6.1) (2022-11-30)
data/README.md CHANGED
@@ -203,17 +203,10 @@ Usage:
203
203
  Options:
204
204
  [--before-seconds-ago=SECONDS] # Destroy records finished more than this many seconds ago (env var: GOOD_JOB_CLEANUP_PRESERVED_JOBS_BEFORE_SECONDS_AGO, default: 1209600 (14 days))
205
205
 
206
- Destroys preserved job records.
206
+ Manually destroys preserved job records.
207
207
 
208
- By default, GoodJob destroys job records when the job is performed and this
209
- command is not necessary.
210
-
211
- However, when `GoodJob.preserve_job_records = true`, the jobs will be
212
- preserved in the database. This is useful when wanting to analyze or
213
- inspect job performance.
214
-
215
- If you are preserving job records this way, use this command regularly
216
- to destroy old records and preserve space in your database.
208
+ By default, GoodJob automatically destroys job records when the job is performed
209
+ and this command is not required to be used.
217
210
  ```
218
211
 
219
212
  ### Configuration options
@@ -460,7 +453,9 @@ GoodJob's concurrency control strategy for `perform_limit` is "optimistic retry
460
453
 
461
454
  GoodJob can enqueue jobs on a recurring basis that can be used as a replacement for cron.
462
455
 
463
- Cron-style jobs are run on every GoodJob process (e.g. CLI or `async` execution mode) when `config.good_job.enable_cron = true`, but GoodJob's cron uses unique indexes to ensure that only a single job is enqueued at the given time interval.
456
+ Cron-style jobs are run on every GoodJob process (e.g. CLI or `async` execution mode) when `config.good_job.enable_cron = true`.
457
+
458
+ GoodJob's cron uses unique indexes to ensure that only a single job is enqueued at the given time interval. In order for this to work, GoodJob must preserve cron-created job records; these records will be automatically deleted like any other preserved record.
464
459
 
465
460
  Cron-format is parsed by the [`fugit`](https://github.com/floraison/fugit) gem, which has support for seconds-level resolution (e.g. `* * * * * *`) and natural language parsing (e.g. `every second`).
466
461
 
@@ -300,7 +300,7 @@ module GoodJob
300
300
  reenqueued = result.retried? || retried_good_job_id.present?
301
301
  if result.unhandled_error && GoodJob.retry_on_unhandled_error
302
302
  save!
303
- elsif GoodJob.preserve_job_records == true || reenqueued || (result.unhandled_error && GoodJob.preserve_job_records == :on_unhandled_error)
303
+ elsif GoodJob.preserve_job_records == true || reenqueued || (result.unhandled_error && GoodJob.preserve_job_records == :on_unhandled_error) || cron_key.present?
304
304
  self.finished_at = Time.current
305
305
  save!
306
306
  else
data/lib/good_job/cli.rb CHANGED
@@ -128,17 +128,10 @@ module GoodJob
128
128
  # @!macro thor.desc
129
129
  desc :cleanup_preserved_jobs, "Destroys preserved job records."
130
130
  long_desc <<~DESCRIPTION
131
- Destroys preserved job records.
131
+ Manually destroys preserved job records.
132
132
 
133
- By default, GoodJob destroys job records when the job is performed and this
134
- command is not necessary.
135
-
136
- However, when `GoodJob.preserve_job_records = true`, the jobs will be
137
- preserved in the database. This is useful when wanting to analyze or
138
- inspect job performance.
139
-
140
- If you are preserving job records this way, use this command regularly
141
- to destroy old records and preserve space in your database.
133
+ By default, GoodJob automatically destroys job records when the job is performed
134
+ and this command is not required to be used.
142
135
 
143
136
  DESCRIPTION
144
137
  method_option :before_seconds_ago,
@@ -221,8 +221,7 @@ module GoodJob
221
221
  )&.to_i
222
222
  end
223
223
 
224
- # Whether to destroy discarded jobs when cleaning up preserved jobs.
225
- # This configuration is only used when {GoodJob.preserve_job_records} is +true+.
224
+ # Whether to automatically destroy discarded jobs that have been preserved.
226
225
  # @return [Boolean]
227
226
  def cleanup_discarded_jobs?
228
227
  return rails_config[:cleanup_discarded_jobs] unless rails_config[:cleanup_discarded_jobs].nil?
@@ -231,8 +230,7 @@ module GoodJob
231
230
  true
232
231
  end
233
232
 
234
- # Number of seconds to preserve jobs when using the +good_job cleanup_preserved_jobs+ CLI command.
235
- # This configuration is only used when {GoodJob.preserve_job_records} is +true+.
233
+ # Number of seconds to preserve jobs before automatic destruction.
236
234
  # @return [Integer]
237
235
  def cleanup_preserved_jobs_before_seconds_ago
238
236
  (
@@ -243,7 +241,7 @@ module GoodJob
243
241
  ).to_i
244
242
  end
245
243
 
246
- # Number of jobs a {Scheduler} will execute before cleaning up preserved jobs.
244
+ # Number of jobs a {Scheduler} will execute before automatically cleaning up preserved jobs.
247
245
  # @return [Integer, nil]
248
246
  def cleanup_interval_jobs
249
247
  value = (
@@ -254,7 +252,7 @@ module GoodJob
254
252
  value.present? ? value.to_i : nil
255
253
  end
256
254
 
257
- # Number of seconds a {Scheduler} will wait before cleaning up preserved jobs.
255
+ # Number of seconds a {Scheduler} will wait before automatically cleaning up preserved jobs.
258
256
  # @return [Integer, nil]
259
257
  def cleanup_interval_seconds
260
258
  value = (
@@ -53,7 +53,7 @@ module GoodJob
53
53
  process_id = event.payload[:process_id]
54
54
 
55
55
  info(tags: [process_id]) do
56
- "GoodJob started scheduler with queues=#{performer_name} max_threads=#{max_threads}."
56
+ "GoodJob #{GoodJob::VERSION} started scheduler with queues=#{performer_name} max_threads=#{max_threads}."
57
57
  end
58
58
  end
59
59
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module GoodJob
3
3
  # GoodJob gem version.
4
- VERSION = '3.6.2'
4
+ VERSION = '3.7.0'
5
5
  end
data/lib/good_job.rb CHANGED
@@ -54,9 +54,10 @@ module GoodJob
54
54
  # @!attribute [rw] preserve_job_records
55
55
  # @!scope class
56
56
  # Whether to preserve job records in the database after they have finished (default: +true+).
57
- # By default, GoodJob deletes job records after the job is completed successfully.
58
57
  # If you want to preserve jobs for latter inspection, set this to +true+.
59
58
  # If you want to preserve only jobs that finished with error for latter inspection, set this to +:on_unhandled_error+.
59
+ # If you do not want to preserve jobs, set this to +false+.
60
+ # When using GoodJob's cron functionality, job records will be preserved for a brief time to prevent duplicate jobs.
60
61
  # @return [Boolean, Symbol, nil]
61
62
  mattr_accessor :preserve_job_records, default: true
62
63
 
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.6.2
4
+ version: 3.7.0
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-04 00:00:00.000000000 Z
11
+ date: 2022-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob