good_job 3.29.4 → 3.30.0
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 +29 -0
- data/README.md +3 -3
- data/app/models/good_job/discrete_execution.rb +13 -2
- data/app/models/good_job/execution.rb +8 -1
- data/lib/generators/good_job/templates/install/migrations/create_good_jobs.rb.erb +1 -0
- data/lib/generators/good_job/templates/update/migrations/15_create_good_job_execution_duration.rb.erb +15 -0
- data/lib/good_job/probe_server/webrick_handler.rb +11 -1
- data/lib/good_job/version.rb +1 -1
- data/lib/good_job.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7a62f9aed6b7846a54575fc79d8bb6e164f4236a0e1089eeaf2d2d7ded5e2561
|
|
4
|
+
data.tar.gz: cf93bd4a95f4cbd143442ecb5e4d3a1eff77cdecd9e703ee711ea22d2aba2b4e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aca712916a3b886d92ae128ee6f238a20a6af8d13bfba3b33b4064820fcbe3317f077fb6a4eac39377f14dcfb10078f0e2ed4c21f81ad9422e59769982aa6d8c
|
|
7
|
+
data.tar.gz: 2adc01f26ea9e2155073224a1cf9a42049c63f67c7bb5ffc87f07c1dd95f30cbbd958b15f9b50e0bbf645e132b331f592c9aa6cf182b110484bc807f6b024ef2
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v3.30.0](https://github.com/bensheldon/good_job/tree/v3.30.0) (2024-07-05)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.29.5...v3.30.0)
|
|
6
|
+
|
|
7
|
+
**Implemented enhancements:**
|
|
8
|
+
|
|
9
|
+
- Added GoodJob::DiscreteExecution\#duration column [\#1374](https://github.com/bensheldon/good_job/pull/1374) ([SebouChu](https://github.com/SebouChu))
|
|
10
|
+
|
|
11
|
+
**Closed issues:**
|
|
12
|
+
|
|
13
|
+
- Job retried infinitely [\#1384](https://github.com/bensheldon/good_job/issues/1384)
|
|
14
|
+
|
|
15
|
+
**Merged pull requests:**
|
|
16
|
+
|
|
17
|
+
- Use newer syntax in documentation for `wait` config on `retry` [\#1380](https://github.com/bensheldon/good_job/pull/1380) ([benoittgt](https://github.com/benoittgt))
|
|
18
|
+
|
|
19
|
+
## [v3.29.5](https://github.com/bensheldon/good_job/tree/v3.29.5) (2024-06-24)
|
|
20
|
+
|
|
21
|
+
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.29.4...v3.29.5)
|
|
22
|
+
|
|
23
|
+
**Fixed bugs:**
|
|
24
|
+
|
|
25
|
+
- fix: require rack/handler for rack \>= 3.1.x [\#1383](https://github.com/bensheldon/good_job/pull/1383) ([shouichi](https://github.com/shouichi))
|
|
26
|
+
|
|
27
|
+
**Closed issues:**
|
|
28
|
+
|
|
29
|
+
- Unexpected behavior of calling perform\_now inside another job [\#1379](https://github.com/bensheldon/good_job/issues/1379)
|
|
30
|
+
- \[BUG\] \[Dashboard\] count isn't following by the filter [\#1376](https://github.com/bensheldon/good_job/issues/1376)
|
|
31
|
+
|
|
3
32
|
## [v3.29.4](https://github.com/bensheldon/good_job/tree/v3.29.4) (2024-06-18)
|
|
4
33
|
|
|
5
34
|
[Full Changelog](https://github.com/bensheldon/good_job/compare/v3.29.3...v3.29.4)
|
data/README.md
CHANGED
|
@@ -933,7 +933,7 @@ Active Job can be configured to retry an infinite number of times, with a polyno
|
|
|
933
933
|
|
|
934
934
|
```ruby
|
|
935
935
|
class ApplicationJob < ActiveJob::Base
|
|
936
|
-
retry_on StandardError, wait: :
|
|
936
|
+
retry_on StandardError, wait: :polynomially_longer, attempts: Float::INFINITY
|
|
937
937
|
# ...
|
|
938
938
|
end
|
|
939
939
|
```
|
|
@@ -953,7 +953,7 @@ When using `retry_on` with an infinite number of retries, exceptions will never
|
|
|
953
953
|
|
|
954
954
|
```ruby
|
|
955
955
|
class ApplicationJob < ActiveJob::Base
|
|
956
|
-
retry_on StandardError, wait: :
|
|
956
|
+
retry_on StandardError, wait: :polynomially_longer, attempts: Float::INFINITY
|
|
957
957
|
|
|
958
958
|
retry_on SpecialError, attempts: 5 do |_job, exception|
|
|
959
959
|
Rails.error.report(exception)
|
|
@@ -979,7 +979,7 @@ You can use an initializer to configure `ActionMailer::MailDeliveryJob`, for exa
|
|
|
979
979
|
|
|
980
980
|
```ruby
|
|
981
981
|
# config/initializers/good_job.rb
|
|
982
|
-
ActionMailer::MailDeliveryJob.retry_on StandardError, wait: :
|
|
982
|
+
ActionMailer::MailDeliveryJob.retry_on StandardError, wait: :polynomially_longer, attempts: Float::INFINITY
|
|
983
983
|
|
|
984
984
|
# With Sentry (or Bugsnag, Airbrake, Honeybadger, etc.)
|
|
985
985
|
ActionMailer::MailDeliveryJob.around_perform do |_job, block|
|
|
@@ -28,6 +28,13 @@ module GoodJob # :nodoc:
|
|
|
28
28
|
false
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
+
def self.monotonic_duration_migrated?
|
|
32
|
+
return true if columns_hash["duration"].present?
|
|
33
|
+
|
|
34
|
+
migration_pending_warning!
|
|
35
|
+
false
|
|
36
|
+
end
|
|
37
|
+
|
|
31
38
|
def number
|
|
32
39
|
serialized_params.fetch('executions', 0) + 1
|
|
33
40
|
end
|
|
@@ -37,9 +44,13 @@ module GoodJob # :nodoc:
|
|
|
37
44
|
created_at - scheduled_at
|
|
38
45
|
end
|
|
39
46
|
|
|
40
|
-
#
|
|
47
|
+
# Monotonic time between when this job started and finished
|
|
41
48
|
def runtime_latency
|
|
42
|
-
|
|
49
|
+
if self.class.monotonic_duration_migrated?
|
|
50
|
+
duration
|
|
51
|
+
elsif performed_at
|
|
52
|
+
(finished_at || Time.current) - performed_at
|
|
53
|
+
end
|
|
43
54
|
end
|
|
44
55
|
|
|
45
56
|
def last_status_at
|
|
@@ -372,6 +372,7 @@ module GoodJob
|
|
|
372
372
|
raise PreviouslyPerformedError, 'Cannot perform a job that has already been performed' if finished_at
|
|
373
373
|
|
|
374
374
|
job_performed_at = Time.current
|
|
375
|
+
monotonic_start = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
|
|
375
376
|
discrete_execution = nil
|
|
376
377
|
result = GoodJob::CurrentThread.within do |current_thread|
|
|
377
378
|
current_thread.reset
|
|
@@ -385,12 +386,14 @@ module GoodJob
|
|
|
385
386
|
interrupt_error_string = self.class.format_error(GoodJob::InterruptError.new("Interrupted after starting perform at '#{existing_performed_at}'"))
|
|
386
387
|
self.error = interrupt_error_string
|
|
387
388
|
self.error_event = ERROR_EVENT_INTERRUPTED if self.class.error_event_migrated?
|
|
389
|
+
monotonic_duration = (::Process.clock_gettime(::Process::CLOCK_MONOTONIC) - monotonic_start).seconds
|
|
388
390
|
|
|
389
391
|
discrete_execution_attrs = {
|
|
390
392
|
error: interrupt_error_string,
|
|
391
393
|
finished_at: job_performed_at,
|
|
392
394
|
}
|
|
393
395
|
discrete_execution_attrs[:error_event] = GoodJob::ErrorEvents::ERROR_EVENT_ENUMS[GoodJob::ErrorEvents::ERROR_EVENT_INTERRUPTED] if self.class.error_event_migrated?
|
|
396
|
+
discrete_execution_attrs[:duration] = monotonic_duration if GoodJob::DiscreteExecution.monotonic_duration_migrated?
|
|
394
397
|
discrete_executions.where(finished_at: nil).where.not(performed_at: nil).update_all(discrete_execution_attrs) # rubocop:disable Rails/SkipsModelValidations
|
|
395
398
|
end
|
|
396
399
|
end
|
|
@@ -494,8 +497,12 @@ module GoodJob
|
|
|
494
497
|
job_attributes.delete(:error_event) unless self.class.error_event_migrated?
|
|
495
498
|
|
|
496
499
|
job_finished_at = Time.current
|
|
500
|
+
monotonic_duration = (::Process.clock_gettime(::Process::CLOCK_MONOTONIC) - monotonic_start).seconds
|
|
497
501
|
job_attributes[:finished_at] = job_finished_at
|
|
498
|
-
|
|
502
|
+
if discrete_execution
|
|
503
|
+
discrete_execution.finished_at = job_finished_at
|
|
504
|
+
discrete_execution.duration = monotonic_duration if GoodJob::DiscreteExecution.monotonic_duration_migrated?
|
|
505
|
+
end
|
|
499
506
|
|
|
500
507
|
retry_unhandled_error = result.unhandled_error && GoodJob.retry_on_unhandled_error
|
|
501
508
|
reenqueued = result.retried? || retried_good_job_id.present? || retry_unhandled_error
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class CreateGoodJobExecutionDuration < ActiveRecord::Migration<%= migration_version %>
|
|
4
|
+
def change
|
|
5
|
+
reversible do |dir|
|
|
6
|
+
dir.up do
|
|
7
|
+
# Ensure this incremental update migration is idempotent
|
|
8
|
+
# with monolithic install migration.
|
|
9
|
+
return if connection.column_exists?(:good_job_executions, :duration)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
add_column :good_job_executions, :duration, :interval
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -7,7 +7,17 @@ module GoodJob
|
|
|
7
7
|
@app = app
|
|
8
8
|
@port = options[:port]
|
|
9
9
|
@logger = options[:logger]
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
# Workaround for rack >= 3.1.x as auto-loading of rack/handler was removed.
|
|
12
|
+
# We should move to rackup in the long run.
|
|
13
|
+
# See https://github.com/rack/rack/pull/1937.
|
|
14
|
+
@handler = begin
|
|
15
|
+
require 'rackup/handler'
|
|
16
|
+
::Rackup::Handler.get('webrick')
|
|
17
|
+
rescue LoadError
|
|
18
|
+
require "rack/handler"
|
|
19
|
+
::Rack::Handler.get('webrick')
|
|
20
|
+
end
|
|
11
21
|
end
|
|
12
22
|
|
|
13
23
|
def stop
|
data/lib/good_job/version.rb
CHANGED
data/lib/good_job.rb
CHANGED
|
@@ -286,8 +286,8 @@ module GoodJob
|
|
|
286
286
|
# @return [Boolean]
|
|
287
287
|
def self.migrated?
|
|
288
288
|
# Always update with the most recent migration check
|
|
289
|
-
GoodJob::
|
|
290
|
-
GoodJob::
|
|
289
|
+
GoodJob::DiscreteExecution.reset_column_information
|
|
290
|
+
GoodJob::DiscreteExecution.monotonic_duration_migrated?
|
|
291
291
|
end
|
|
292
292
|
|
|
293
293
|
ActiveSupport.run_load_hooks(:good_job, self)
|
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.
|
|
4
|
+
version: 3.30.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: 2024-
|
|
11
|
+
date: 2024-07-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activejob
|
|
@@ -362,6 +362,7 @@ files:
|
|
|
362
362
|
- lib/generators/good_job/templates/update/migrations/12_create_good_job_execution_error_backtrace.rb.erb
|
|
363
363
|
- lib/generators/good_job/templates/update/migrations/13_create_good_job_process_lock_ids.rb.erb
|
|
364
364
|
- lib/generators/good_job/templates/update/migrations/14_create_good_job_process_lock_indexes.rb.erb
|
|
365
|
+
- lib/generators/good_job/templates/update/migrations/15_create_good_job_execution_duration.rb.erb
|
|
365
366
|
- lib/generators/good_job/update_generator.rb
|
|
366
367
|
- lib/good_job.rb
|
|
367
368
|
- lib/good_job/active_job_extensions/batches.rb
|