good_job 4.0.1 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/app/models/good_job/base_execution.rb +2 -19
- data/app/models/good_job/discrete_execution.rb +3 -0
- data/app/models/good_job/job.rb +0 -2
- data/lib/good_job/cleanup_tracker.rb +1 -1
- data/lib/good_job/configuration.rb +27 -58
- data/lib/good_job/version.rb +1 -1
- data/lib/good_job.rb +5 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2bd0a03d12095efe56c49c36fce5dbef909efbb4a984203c49b5ad2e0ba2fc5
|
4
|
+
data.tar.gz: 5bc6fc1c127bcffe8388b8f0994c3a2c82b31952387c6be67a35fc280bf1c4cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a4c1d788d8c8ea031b4b4654b65b7fe170a0f24d1ffb2550a150de100c8c73f66a4b7d3b19bce99b7f752230c50c5b59829bd906cc3036759553b5615b1b451
|
7
|
+
data.tar.gz: 25b4458b92cbeca4db9f6486ee73e41f415b12ab585b35d7724f24e88f99e86b038be2e73f67b4e4bc6c60ff3d01df7903529ab9c859d3df9259db0a113460bc
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v4.0.2](https://github.com/bensheldon/good_job/tree/v4.0.2) (2024-07-08)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v4.0.1...v4.0.2)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- Fix a rails 6.1 deprecation warning for the duration attribute [\#1408](https://github.com/bensheldon/good_job/pull/1408) ([Earlopain](https://github.com/Earlopain))
|
10
|
+
- Actually remove deprecated configuration for `cleanup_interval_seconds`, `cleanup_interval_jobs`; remove deprecated `Lockable` [\#1406](https://github.com/bensheldon/good_job/pull/1406) ([bensheldon](https://github.com/bensheldon))
|
11
|
+
|
12
|
+
**Closed issues:**
|
13
|
+
|
14
|
+
- PG::UndefinedColumn: ERROR: column good\_job\_processes.lock\_type does not exist [\#1405](https://github.com/bensheldon/good_job/issues/1405)
|
15
|
+
- undefined method `duration=' for an instance of GoodJob::Execution [\#1404](https://github.com/bensheldon/good_job/issues/1404)
|
16
|
+
- v3 deprecations are still present [\#1399](https://github.com/bensheldon/good_job/issues/1399)
|
17
|
+
|
18
|
+
**Merged pull requests:**
|
19
|
+
|
20
|
+
- Fix Batch integration test to not exhaust database connection thread pool [\#1409](https://github.com/bensheldon/good_job/pull/1409) ([bensheldon](https://github.com/bensheldon))
|
21
|
+
- Discrete cleanup [\#1401](https://github.com/bensheldon/good_job/pull/1401) ([Earlopain](https://github.com/Earlopain))
|
22
|
+
|
3
23
|
## [v4.0.1](https://github.com/bensheldon/good_job/tree/v4.0.1) (2024-07-08)
|
4
24
|
|
5
25
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v4.0.0...v4.0.1)
|
@@ -25,6 +25,8 @@ module GoodJob
|
|
25
25
|
self.advisory_lockable_column = 'active_job_id'
|
26
26
|
self.implicit_order_column = 'created_at'
|
27
27
|
|
28
|
+
self.ignored_columns += ["is_discrete"]
|
29
|
+
|
28
30
|
define_model_callbacks :perform
|
29
31
|
define_model_callbacks :perform_unlocked, only: :after
|
30
32
|
|
@@ -216,14 +218,6 @@ module GoodJob
|
|
216
218
|
def coalesce_scheduled_at_created_at
|
217
219
|
arel_table.coalesce(arel_table['scheduled_at'], arel_table['created_at'])
|
218
220
|
end
|
219
|
-
|
220
|
-
def discrete_support?
|
221
|
-
true
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
def discrete?
|
226
|
-
is_discrete?
|
227
221
|
end
|
228
222
|
|
229
223
|
# Build an ActiveJob instance and deserialize the arguments, using `#active_job_data`.
|
@@ -545,17 +539,6 @@ module GoodJob
|
|
545
539
|
false
|
546
540
|
end
|
547
541
|
|
548
|
-
def make_discrete
|
549
|
-
self.is_discrete = true
|
550
|
-
self.id = active_job_id
|
551
|
-
self.job_class = serialized_params['job_class']
|
552
|
-
self.executions_count ||= 0
|
553
|
-
|
554
|
-
current_time = Time.current
|
555
|
-
self.created_at ||= current_time
|
556
|
-
self.scheduled_at ||= current_time
|
557
|
-
end
|
558
|
-
|
559
542
|
# Return formatted serialized_params for display in the dashboard
|
560
543
|
# @return [Hash]
|
561
544
|
def display_serialized_params
|
data/app/models/good_job/job.rb
CHANGED
@@ -46,8 +46,6 @@ module GoodJob
|
|
46
46
|
# Errored but will not be retried
|
47
47
|
scope :discarded, -> { finished.where.not(error: nil) }
|
48
48
|
|
49
|
-
scope :unfinished_undiscrete, -> { where(finished_at: nil, retried_good_job_id: nil, is_discrete: [nil, false]) }
|
50
|
-
|
51
49
|
# TODO: it would be nice to enforce these values at the model
|
52
50
|
# validates :active_job_id, presence: true
|
53
51
|
# validates :scheduled_at, presence: true
|
@@ -9,7 +9,7 @@ module GoodJob # :nodoc:
|
|
9
9
|
:last_at
|
10
10
|
|
11
11
|
def initialize(cleanup_interval_seconds: false, cleanup_interval_jobs: false)
|
12
|
-
raise ArgumentError, "Do not use `0
|
12
|
+
raise ArgumentError, "Do not use `0` for cleanup intervals. Use `false` to disable, or -1 to always run" if cleanup_interval_seconds == 0 || cleanup_interval_jobs == 0 # rubocop:disable Style/NumericPredicate
|
13
13
|
|
14
14
|
self.cleanup_interval_seconds = cleanup_interval_seconds
|
15
15
|
self.cleanup_interval_jobs = cleanup_interval_jobs
|
@@ -230,8 +230,8 @@ module GoodJob
|
|
230
230
|
def queue_select_limit
|
231
231
|
(
|
232
232
|
options[:queue_select_limit] ||
|
233
|
-
|
234
|
-
|
233
|
+
rails_config[:queue_select_limit] ||
|
234
|
+
env['GOOD_JOB_QUEUE_SELECT_LIMIT']
|
235
235
|
)&.to_i
|
236
236
|
end
|
237
237
|
|
@@ -240,8 +240,8 @@ module GoodJob
|
|
240
240
|
def idle_timeout
|
241
241
|
(
|
242
242
|
options[:idle_timeout] ||
|
243
|
-
|
244
|
-
|
243
|
+
rails_config[:idle_timeout] ||
|
244
|
+
env['GOOD_JOB_IDLE_TIMEOUT']
|
245
245
|
)&.to_i || nil
|
246
246
|
end
|
247
247
|
|
@@ -269,69 +269,38 @@ module GoodJob
|
|
269
269
|
# Positive values will clean up after that many jobs have run, false or 0 will disable, and -1 will clean up after every job.
|
270
270
|
# @return [Integer, Boolean, nil]
|
271
271
|
def cleanup_interval_jobs
|
272
|
-
if rails_config.key?(:cleanup_interval_jobs)
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
)
|
283
|
-
value = -1
|
284
|
-
end
|
285
|
-
elsif env.key?('GOOD_JOB_CLEANUP_INTERVAL_JOBS')
|
286
|
-
value = env['GOOD_JOB_CLEANUP_INTERVAL_JOBS']
|
287
|
-
if value.blank?
|
288
|
-
GoodJob.deprecator.warn(
|
289
|
-
%(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.)
|
290
|
-
)
|
291
|
-
value = false
|
292
|
-
elsif value == '0'
|
293
|
-
value = false
|
294
|
-
end
|
272
|
+
value = if rails_config.key?(:cleanup_interval_jobs)
|
273
|
+
rails_config[:cleanup_interval_jobs]
|
274
|
+
elsif env.key?('GOOD_JOB_CLEANUP_INTERVAL_JOBS')
|
275
|
+
env['GOOD_JOB_CLEANUP_INTERVAL_JOBS']
|
276
|
+
end
|
277
|
+
|
278
|
+
if value.in? [nil, "", true]
|
279
|
+
DEFAULT_CLEANUP_INTERVAL_JOBS
|
280
|
+
elsif value.in? [0, "0", false, "false"]
|
281
|
+
false
|
295
282
|
else
|
296
|
-
value
|
283
|
+
value ? value.to_i : false
|
297
284
|
end
|
298
|
-
|
299
|
-
value ? value.to_i : false
|
300
285
|
end
|
301
286
|
|
302
287
|
# Number of seconds a {Scheduler} will wait before automatically cleaning up preserved jobs.
|
303
288
|
# Positive values will clean up after that many jobs have run, false or 0 will disable, and -1 will clean up after every job.
|
304
|
-
# @return [Integer, nil]
|
289
|
+
# @return [Integer, Boolean, nil]
|
305
290
|
def cleanup_interval_seconds
|
306
|
-
if rails_config.key?(:cleanup_interval_seconds)
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
%(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.)
|
317
|
-
)
|
318
|
-
value = -1
|
319
|
-
end
|
320
|
-
elsif env.key?('GOOD_JOB_CLEANUP_INTERVAL_SECONDS')
|
321
|
-
value = env['GOOD_JOB_CLEANUP_INTERVAL_SECONDS']
|
322
|
-
if value.blank?
|
323
|
-
GoodJob.deprecator.warn(
|
324
|
-
%(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.)
|
325
|
-
)
|
326
|
-
value = false
|
327
|
-
elsif value == '0'
|
328
|
-
value = false
|
329
|
-
end
|
291
|
+
value = if rails_config.key?(:cleanup_interval_seconds)
|
292
|
+
rails_config[:cleanup_interval_seconds]
|
293
|
+
elsif env.key?('GOOD_JOB_CLEANUP_INTERVAL_SECONDS')
|
294
|
+
env['GOOD_JOB_CLEANUP_INTERVAL_SECONDS']
|
295
|
+
end
|
296
|
+
|
297
|
+
if value.nil? || value == "" || value == true
|
298
|
+
DEFAULT_CLEANUP_INTERVAL_SECONDS
|
299
|
+
elsif value.in? [0, "0", false, "false"]
|
300
|
+
false
|
330
301
|
else
|
331
|
-
value
|
302
|
+
value ? value.to_i : false
|
332
303
|
end
|
333
|
-
|
334
|
-
value ? value.to_i : false
|
335
304
|
end
|
336
305
|
|
337
306
|
# Tests whether to daemonize the process.
|
data/lib/good_job/version.rb
CHANGED
data/lib/good_job.rb
CHANGED
@@ -269,7 +269,11 @@ module GoodJob
|
|
269
269
|
# Tests whether GoodJob can be safely upgraded to v4
|
270
270
|
# @return [Boolean]
|
271
271
|
def self.v4_ready?
|
272
|
-
GoodJob
|
272
|
+
GoodJob.deprecator.warn(<<~MSG)
|
273
|
+
Calling `GoodJob.v4_ready?` is deprecated and will be removed in GoodJob v5.
|
274
|
+
If you are reading this deprecation you are already on v4.
|
275
|
+
MSG
|
276
|
+
true
|
273
277
|
end
|
274
278
|
|
275
279
|
# Deprecator for providing deprecation warnings.
|
@@ -281,9 +285,6 @@ module GoodJob
|
|
281
285
|
end
|
282
286
|
end
|
283
287
|
|
284
|
-
include ActiveSupport::Deprecation::DeprecatedConstantAccessor
|
285
|
-
deprecate_constant :Lockable, 'GoodJob::AdvisoryLockable', deprecator: deprecator
|
286
|
-
|
287
288
|
# Whether all GoodJob migrations have been applied.
|
288
289
|
# For use in tests/CI to validate GoodJob is up-to-date.
|
289
290
|
# @return [Boolean]
|