good_job 3.27.4 → 3.28.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +52 -0
- data/README.md +91 -2
- data/app/frontend/good_job/style.css +4 -0
- data/app/models/concerns/good_job/advisory_lockable.rb +7 -2
- data/app/models/concerns/good_job/filterable.rb +3 -2
- data/app/models/good_job/base_record.rb +4 -0
- data/app/models/good_job/batch_record.rb +8 -2
- data/app/models/good_job/discrete_execution.rb +11 -0
- data/app/models/good_job/execution.rb +6 -4
- data/app/models/good_job/job.rb +4 -4
- data/app/views/good_job/batches/_jobs.erb +23 -21
- data/app/views/good_job/batches/_table.erb +15 -15
- data/app/views/good_job/jobs/_executions.erb +31 -5
- data/app/views/good_job/jobs/_table.erb +156 -154
- data/app/views/good_job/shared/_filter.erb +9 -9
- data/app/views/good_job/shared/_navbar.erb +1 -1
- data/app/views/good_job/shared/_secondary_navbar.erb +1 -1
- data/app/views/layouts/good_job/application.html.erb +2 -2
- data/config/locales/de.yml +2 -0
- data/config/locales/en.yml +2 -0
- data/config/locales/es.yml +2 -0
- data/config/locales/fr.yml +2 -0
- data/config/locales/it.yml +2 -0
- data/config/locales/ja.yml +2 -0
- data/config/locales/ko.yml +2 -0
- data/config/locales/nl.yml +3 -1
- data/config/locales/pt-BR.yml +2 -0
- data/config/locales/ru.yml +2 -0
- data/config/locales/tr.yml +2 -0
- data/config/locales/uk.yml +2 -0
- data/lib/generators/good_job/templates/install/migrations/create_good_jobs.rb.erb +1 -0
- data/lib/generators/good_job/templates/update/migrations/10_create_good_job_execution_error_backtrace.rb.erb +15 -0
- data/lib/good_job/active_job_extensions/batches.rb +1 -1
- data/lib/good_job/active_job_extensions/concurrency.rb +2 -2
- data/lib/good_job/active_job_extensions/notify_options.rb +1 -1
- data/lib/good_job/capsule.rb +10 -6
- data/lib/good_job/version.rb +1 -1
- data/lib/good_job.rb +2 -2
- metadata +4 -31
data/config/locales/ru.yml
CHANGED
data/config/locales/tr.yml
CHANGED
data/config/locales/uk.yml
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateGoodJobExecutionErrorBacktrace < 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, :error_backtrace)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
add_column :good_job_executions, :error_backtrace, :text, array: true
|
14
|
+
end
|
15
|
+
end
|
@@ -6,7 +6,7 @@ module GoodJob
|
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
8
|
def batch
|
9
|
-
@_batch ||= CurrentThread.execution&.batch&.to_batch
|
9
|
+
@_batch ||= CurrentThread.execution&.batch&.to_batch if CurrentThread.execution.present? && CurrentThread.execution.active_job_id == job_id
|
10
10
|
end
|
11
11
|
alias batch? batch
|
12
12
|
end
|
@@ -75,7 +75,7 @@ module GoodJob
|
|
75
75
|
key = job.good_job_concurrency_key
|
76
76
|
next if key.blank?
|
77
77
|
|
78
|
-
if CurrentThread.execution.blank?
|
78
|
+
if CurrentThread.execution.blank? || CurrentThread.execution.active_job_id != job_id
|
79
79
|
logger.debug("Ignoring concurrency limits because the job is executed with `perform_now`.")
|
80
80
|
next
|
81
81
|
end
|
@@ -96,7 +96,7 @@ module GoodJob
|
|
96
96
|
|
97
97
|
query = DiscreteExecution.joins(:job)
|
98
98
|
.where(GoodJob::Job.table_name => { concurrency_key: key })
|
99
|
-
.where(DiscreteExecution.arel_table[:created_at].gt(throttle_period.ago))
|
99
|
+
.where(DiscreteExecution.arel_table[:created_at].gt(DiscreteExecution.bind_value('created_at', throttle_period.ago, ActiveRecord::Type::DateTime)))
|
100
100
|
allowed_active_job_ids = query.where(error: nil).or(query.where.not(error: "GoodJob::ActiveJobExtensions::Concurrency::ThrottleExceededError: GoodJob::ActiveJobExtensions::Concurrency::ThrottleExceededError"))
|
101
101
|
.order(created_at: :asc)
|
102
102
|
.limit(throttle_limit)
|
data/lib/good_job/capsule.rb
CHANGED
@@ -12,7 +12,7 @@ module GoodJob
|
|
12
12
|
cattr_reader :instances, default: Concurrent::Array.new, instance_reader: false
|
13
13
|
|
14
14
|
# @param configuration [GoodJob::Configuration] Configuration to use for this capsule.
|
15
|
-
def initialize(configuration:
|
15
|
+
def initialize(configuration: nil)
|
16
16
|
@configuration = configuration
|
17
17
|
@startable = true
|
18
18
|
@started_at = nil
|
@@ -30,13 +30,13 @@ module GoodJob
|
|
30
30
|
return unless startable?(force: force)
|
31
31
|
|
32
32
|
@shared_executor = GoodJob::SharedExecutor.new
|
33
|
-
@notifier = GoodJob::Notifier.new(enable_listening:
|
34
|
-
@poller = GoodJob::Poller.new(poll_interval:
|
35
|
-
@multi_scheduler = GoodJob::MultiScheduler.from_configuration(
|
33
|
+
@notifier = GoodJob::Notifier.new(enable_listening: configuration.enable_listen_notify, executor: @shared_executor.executor)
|
34
|
+
@poller = GoodJob::Poller.new(poll_interval: configuration.poll_interval)
|
35
|
+
@multi_scheduler = GoodJob::MultiScheduler.from_configuration(configuration, warm_cache_on_initialize: true)
|
36
36
|
@notifier.recipients.push([@multi_scheduler, :create_thread])
|
37
37
|
@poller.recipients.push(-> { @multi_scheduler.create_thread({ fanout: true }) })
|
38
38
|
|
39
|
-
@cron_manager = GoodJob::CronManager.new(
|
39
|
+
@cron_manager = GoodJob::CronManager.new(configuration.cron_entries, start_on_initialize: true, executor: @shared_executor.executor) if configuration.enable_cron?
|
40
40
|
|
41
41
|
@startable = false
|
42
42
|
@started_at = Time.current
|
@@ -51,7 +51,7 @@ module GoodJob
|
|
51
51
|
# * +nil+ will trigger a shutdown but not wait for it to complete.
|
52
52
|
# @return [void]
|
53
53
|
def shutdown(timeout: NONE)
|
54
|
-
timeout =
|
54
|
+
timeout = configuration.shutdown_timeout if timeout == NONE
|
55
55
|
GoodJob._shutdown_all([@shared_executor, @notifier, @poller, @multi_scheduler, @cron_manager].compact, timeout: timeout)
|
56
56
|
@startable = false
|
57
57
|
@started_at = nil
|
@@ -101,6 +101,10 @@ module GoodJob
|
|
101
101
|
|
102
102
|
private
|
103
103
|
|
104
|
+
def configuration
|
105
|
+
@configuration || GoodJob.configuration
|
106
|
+
end
|
107
|
+
|
104
108
|
def startable?(force: false)
|
105
109
|
!@started_at && (@startable || force)
|
106
110
|
end
|
data/lib/good_job/version.rb
CHANGED
data/lib/good_job.rb
CHANGED
@@ -203,7 +203,7 @@ module GoodJob
|
|
203
203
|
deleted_batches_count = 0
|
204
204
|
deleted_discrete_executions_count = 0
|
205
205
|
|
206
|
-
jobs_query = GoodJob::Job.
|
206
|
+
jobs_query = GoodJob::Job.finished_before(timestamp).order(finished_at: :asc).limit(in_batches_of)
|
207
207
|
jobs_query = jobs_query.succeeded unless include_discarded
|
208
208
|
loop do
|
209
209
|
active_job_ids = jobs_query.pluck(:active_job_id)
|
@@ -219,7 +219,7 @@ module GoodJob
|
|
219
219
|
end
|
220
220
|
|
221
221
|
if GoodJob::BatchRecord.migrated?
|
222
|
-
batches_query = GoodJob::BatchRecord.
|
222
|
+
batches_query = GoodJob::BatchRecord.finished_before(timestamp).limit(in_batches_of)
|
223
223
|
batches_query = batches_query.succeeded unless include_discarded
|
224
224
|
loop do
|
225
225
|
deleted = batches_query.delete_all
|
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.28.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: 2024-04-
|
11
|
+
date: 2024-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|
@@ -94,20 +94,6 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.14.1
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: benchmark-ips
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: capybara
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,20 +136,6 @@ dependencies:
|
|
150
136
|
- - ">="
|
151
137
|
- !ruby/object:Gem::Version
|
152
138
|
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: pry-rails
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - ">="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
167
139
|
- !ruby/object:Gem::Dependency
|
168
140
|
name: puma
|
169
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -385,6 +357,7 @@ files:
|
|
385
357
|
- lib/generators/good_job/templates/update/migrations/07_recreate_good_job_cron_indexes_with_conditional.rb.erb
|
386
358
|
- lib/generators/good_job/templates/update/migrations/08_create_good_job_labels.rb.erb
|
387
359
|
- lib/generators/good_job/templates/update/migrations/09_create_good_job_labels_index.rb.erb
|
360
|
+
- lib/generators/good_job/templates/update/migrations/10_create_good_job_execution_error_backtrace.rb.erb
|
388
361
|
- lib/generators/good_job/templates/update/migrations/10_remove_good_job_active_id_index.rb.erb
|
389
362
|
- lib/generators/good_job/templates/update/migrations/11_create_index_good_job_jobs_for_candidate_lookup.rb.erb
|
390
363
|
- lib/generators/good_job/update_generator.rb
|
@@ -458,7 +431,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
458
431
|
- !ruby/object:Gem::Version
|
459
432
|
version: '0'
|
460
433
|
requirements: []
|
461
|
-
rubygems_version: 3.5.
|
434
|
+
rubygems_version: 3.5.9
|
462
435
|
signing_key:
|
463
436
|
specification_version: 4
|
464
437
|
summary: A multithreaded, Postgres-based ActiveJob backend for Ruby on Rails
|