From ac43ef66ec223e8289454dafa3859ef16cb91599 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 9 May 2026 22:07:27 +0000 Subject: [PATCH 1/2] Update dependency good_job to v4.18.2 --- Gemfile.lock | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2576ec74..1bb0f566 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -132,7 +132,7 @@ GEM raabro (~> 1.4) globalid (1.3.0) activesupport (>= 6.1) - good_job (4.13.1) + good_job (4.18.2) activejob (>= 6.1.0) activerecord (>= 6.1.0) concurrent-ruby (>= 1.3.1) @@ -161,8 +161,9 @@ GEM mini_magick (>= 4.9.5, < 6) ruby-vips (>= 2.0.17, < 3) io-console (0.8.2) - irb (1.16.0) + irb (1.18.0) pp (>= 0.6.0) + prism (>= 1.3.0) rdoc (>= 4.0.0) reline (>= 0.4.2) json (2.19.5) @@ -205,7 +206,7 @@ GEM net-smtp (0.5.1) net-protocol nio4r (2.7.5) - nokogiri (1.18.10) + nokogiri (1.19.3) mini_portile2 (~> 2.8.2) racc (~> 1.4) open3 (0.2.1) @@ -238,7 +239,7 @@ GEM raabro (1.4.0) racc (1.8.1) rack (3.2.6) - rack-session (2.1.1) + rack-session (2.1.2) base64 (>= 0.1.0) rack (>= 3.0.0) rack-test (2.2.0) @@ -263,8 +264,8 @@ GEM activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.2) - loofah (~> 2.21) + rails-html-sanitizer (1.7.0) + loofah (~> 2.25) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) railties (8.1.3) actionpack (= 8.1.3) @@ -381,8 +382,8 @@ GEM simplecov_json_formatter (0.1.4) stringio (3.2.0) test-prof (1.6.1) - thor (1.4.0) - timeout (0.6.0) + thor (1.5.0) + timeout (0.6.1) triangulum (0.14.3) base64 (~> 0.3) json (~> 2.19) From 553997c2833ea6a8e3deb9e1c79fc1d9c9364809 Mon Sep 17 00:00:00 2001 From: Niklas van Schrick Date: Sun, 17 May 2026 20:11:04 +0200 Subject: [PATCH 2/2] Add new good_job migrations --- ...260517180943_add_lock_type_to_good_jobs.rb | 7 ++++++ ...ood_jobs_for_candidate_dequeue_unlocked.rb | 14 +++++++++++ ...d_index_good_jobs_priority_scheduled_at.rb | 24 +++++++++++++++++++ ...17180946_add_index_good_jobs_queue_name.rb | 12 ++++++++++ ...17180947_add_index_good_jobs_created_at.rb | 12 ++++++++++ ...517180948_add_index_good_jobs_discarded.rb | 14 +++++++++++ ...x_good_jobs_scheduled_at_and_queue_name.rb | 12 ++++++++++ ...ndex_good_jobs_on_unfinished_or_errored.rb | 13 ++++++++++ db/schema_migrations/20260517180943 | 1 + db/schema_migrations/20260517180944 | 1 + db/schema_migrations/20260517180945 | 1 + db/schema_migrations/20260517180946 | 1 + db/schema_migrations/20260517180947 | 1 + db/schema_migrations/20260517180948 | 1 + db/schema_migrations/20260517180949 | 1 + db/schema_migrations/20260517180950 | 1 + db/structure.sql | 19 ++++++++++++++- 17 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20260517180943_add_lock_type_to_good_jobs.rb create mode 100644 db/migrate/20260517180944_add_index_good_jobs_for_candidate_dequeue_unlocked.rb create mode 100644 db/migrate/20260517180945_add_index_good_jobs_priority_scheduled_at.rb create mode 100644 db/migrate/20260517180946_add_index_good_jobs_queue_name.rb create mode 100644 db/migrate/20260517180947_add_index_good_jobs_created_at.rb create mode 100644 db/migrate/20260517180948_add_index_good_jobs_discarded.rb create mode 100644 db/migrate/20260517180949_add_index_good_jobs_scheduled_at_and_queue_name.rb create mode 100644 db/migrate/20260517180950_add_index_good_jobs_on_unfinished_or_errored.rb create mode 100644 db/schema_migrations/20260517180943 create mode 100644 db/schema_migrations/20260517180944 create mode 100644 db/schema_migrations/20260517180945 create mode 100644 db/schema_migrations/20260517180946 create mode 100644 db/schema_migrations/20260517180947 create mode 100644 db/schema_migrations/20260517180948 create mode 100644 db/schema_migrations/20260517180949 create mode 100644 db/schema_migrations/20260517180950 diff --git a/db/migrate/20260517180943_add_lock_type_to_good_jobs.rb b/db/migrate/20260517180943_add_lock_type_to_good_jobs.rb new file mode 100644 index 00000000..7b6afc0e --- /dev/null +++ b/db/migrate/20260517180943_add_lock_type_to_good_jobs.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddLockTypeToGoodJobs < Code0::ZeroTrack::Database::Migration[1.0] + def change + add_column :good_jobs, :lock_type, :integer, limit: 2 unless column_exists?(:good_jobs, :lock_type) + end +end diff --git a/db/migrate/20260517180944_add_index_good_jobs_for_candidate_dequeue_unlocked.rb b/db/migrate/20260517180944_add_index_good_jobs_for_candidate_dequeue_unlocked.rb new file mode 100644 index 00000000..b3e62af6 --- /dev/null +++ b/db/migrate/20260517180944_add_index_good_jobs_for_candidate_dequeue_unlocked.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class AddIndexGoodJobsForCandidateDequeueUnlocked < Code0::ZeroTrack::Database::Migration[1.0] + disable_ddl_transaction! + + def change + add_index :good_jobs, %i[priority scheduled_at id], + name: :index_good_jobs_for_candidate_dequeue_unlocked, + order: { priority: 'ASC NULLS LAST', scheduled_at: :asc, id: :asc }, + where: 'finished_at IS NULL AND locked_by_id IS NULL', + algorithm: :concurrently, + if_not_exists: true + end +end diff --git a/db/migrate/20260517180945_add_index_good_jobs_priority_scheduled_at.rb b/db/migrate/20260517180945_add_index_good_jobs_priority_scheduled_at.rb new file mode 100644 index 00000000..3e224dea --- /dev/null +++ b/db/migrate/20260517180945_add_index_good_jobs_priority_scheduled_at.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +class AddIndexGoodJobsPriorityScheduledAt < Code0::ZeroTrack::Database::Migration[1.0] + disable_ddl_transaction! + + def change + reversible do |dir| + dir.up do + # Ensure this incremental update migration is idempotent + # with monolithic install migration. + return if connection.index_name_exists?(:good_jobs, 'index_good_jobs_on_priority_scheduled_at_unfinished') && + connection.index_name_exists?(:good_jobs, + 'index_good_jobs_on_queue_name_priority_scheduled_at_unfinished') + end + end + + add_index :good_jobs, %i[priority scheduled_at id], + where: 'finished_at IS NULL', name: 'index_good_jobs_on_priority_scheduled_at_unfinished', + algorithm: :concurrently + add_index :good_jobs, %i[queue_name scheduled_at id], + where: 'finished_at IS NULL', name: 'index_good_jobs_on_queue_name_priority_scheduled_at_unfinished', + algorithm: :concurrently + end +end diff --git a/db/migrate/20260517180946_add_index_good_jobs_queue_name.rb b/db/migrate/20260517180946_add_index_good_jobs_queue_name.rb new file mode 100644 index 00000000..295b186c --- /dev/null +++ b/db/migrate/20260517180946_add_index_good_jobs_queue_name.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class AddIndexGoodJobsQueueName < Code0::ZeroTrack::Database::Migration[1.0] + disable_ddl_transaction! + + def change + add_index :good_jobs, :queue_name, + name: :index_good_jobs_on_queue_name, + algorithm: :concurrently, + if_not_exists: true + end +end diff --git a/db/migrate/20260517180947_add_index_good_jobs_created_at.rb b/db/migrate/20260517180947_add_index_good_jobs_created_at.rb new file mode 100644 index 00000000..a7d22604 --- /dev/null +++ b/db/migrate/20260517180947_add_index_good_jobs_created_at.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class AddIndexGoodJobsCreatedAt < Code0::ZeroTrack::Database::Migration[1.0] + disable_ddl_transaction! + + def change + add_index :good_jobs, :created_at, + name: :index_good_jobs_on_created_at, + algorithm: :concurrently, + if_not_exists: true + end +end diff --git a/db/migrate/20260517180948_add_index_good_jobs_discarded.rb b/db/migrate/20260517180948_add_index_good_jobs_discarded.rb new file mode 100644 index 00000000..99f5173c --- /dev/null +++ b/db/migrate/20260517180948_add_index_good_jobs_discarded.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class AddIndexGoodJobsDiscarded < Code0::ZeroTrack::Database::Migration[1.0] + disable_ddl_transaction! + + def change + add_index :good_jobs, :finished_at, + name: :index_good_jobs_on_discarded, + order: { finished_at: :desc }, + where: 'finished_at IS NOT NULL AND error IS NOT NULL', + algorithm: :concurrently, + if_not_exists: true + end +end diff --git a/db/migrate/20260517180949_add_index_good_jobs_scheduled_at_and_queue_name.rb b/db/migrate/20260517180949_add_index_good_jobs_scheduled_at_and_queue_name.rb new file mode 100644 index 00000000..a12db478 --- /dev/null +++ b/db/migrate/20260517180949_add_index_good_jobs_scheduled_at_and_queue_name.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class AddIndexGoodJobsScheduledAtAndQueueName < Code0::ZeroTrack::Database::Migration[1.0] + disable_ddl_transaction! + + def change + add_index :good_jobs, %i[scheduled_at queue_name], + name: :index_good_jobs_on_scheduled_at_and_queue_name, + algorithm: :concurrently, + if_not_exists: true + end +end diff --git a/db/migrate/20260517180950_add_index_good_jobs_on_unfinished_or_errored.rb b/db/migrate/20260517180950_add_index_good_jobs_on_unfinished_or_errored.rb new file mode 100644 index 00000000..22ab2e26 --- /dev/null +++ b/db/migrate/20260517180950_add_index_good_jobs_on_unfinished_or_errored.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddIndexGoodJobsOnUnfinishedOrErrored < Code0::ZeroTrack::Database::Migration[1.0] + disable_ddl_transaction! + + def change + add_index :good_jobs, :id, + name: :index_good_jobs_on_unfinished_or_errored, + where: 'finished_at IS NULL OR error IS NOT NULL', + algorithm: :concurrently, + if_not_exists: true + end +end diff --git a/db/schema_migrations/20260517180943 b/db/schema_migrations/20260517180943 new file mode 100644 index 00000000..848c2fec --- /dev/null +++ b/db/schema_migrations/20260517180943 @@ -0,0 +1 @@ +d52549929012a317aa85f4f37076cd6fd8fab818ea9e402bd55fcdc42a8a0f5b \ No newline at end of file diff --git a/db/schema_migrations/20260517180944 b/db/schema_migrations/20260517180944 new file mode 100644 index 00000000..e7cfc898 --- /dev/null +++ b/db/schema_migrations/20260517180944 @@ -0,0 +1 @@ +adda851653b16a29956e7d5474b7674e925b356869f681a9bef3d3464bc93eb4 \ No newline at end of file diff --git a/db/schema_migrations/20260517180945 b/db/schema_migrations/20260517180945 new file mode 100644 index 00000000..a0460ddd --- /dev/null +++ b/db/schema_migrations/20260517180945 @@ -0,0 +1 @@ +19e3c885ab83aa8d15d84d824e8dc0d8430297b54a58df4e692fbfaa1da254c0 \ No newline at end of file diff --git a/db/schema_migrations/20260517180946 b/db/schema_migrations/20260517180946 new file mode 100644 index 00000000..a2028fef --- /dev/null +++ b/db/schema_migrations/20260517180946 @@ -0,0 +1 @@ +6177c3ffce96080840aa1c7a7774ff0d4288d7e5d3e02844698c80a8ad17453c \ No newline at end of file diff --git a/db/schema_migrations/20260517180947 b/db/schema_migrations/20260517180947 new file mode 100644 index 00000000..16c24671 --- /dev/null +++ b/db/schema_migrations/20260517180947 @@ -0,0 +1 @@ +d717a2206059dd12d8e3a88e2393826f4cdc980752fe57cd81f30120d60be081 \ No newline at end of file diff --git a/db/schema_migrations/20260517180948 b/db/schema_migrations/20260517180948 new file mode 100644 index 00000000..b2f28a1f --- /dev/null +++ b/db/schema_migrations/20260517180948 @@ -0,0 +1 @@ +0a5b234a81003235c5adfa67e0e188c8909ed091c09357169fc087e5fdf8c56b \ No newline at end of file diff --git a/db/schema_migrations/20260517180949 b/db/schema_migrations/20260517180949 new file mode 100644 index 00000000..f6184318 --- /dev/null +++ b/db/schema_migrations/20260517180949 @@ -0,0 +1 @@ +b33d5406709c22de5389c35ccfca939778a3d2a114e8a16253b9dee96ea02277 \ No newline at end of file diff --git a/db/schema_migrations/20260517180950 b/db/schema_migrations/20260517180950 new file mode 100644 index 00000000..6c0d10d8 --- /dev/null +++ b/db/schema_migrations/20260517180950 @@ -0,0 +1 @@ +302f53f804d4ce8a58abb9b194d62dbfbb7ecb00d77c25c1f86bdac17bf8ee99 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 6457a847..8a2c025d 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -392,7 +392,8 @@ CREATE TABLE good_jobs ( error_event smallint, labels text[], locked_by_id uuid, - locked_at timestamp with time zone + locked_at timestamp with time zone, + lock_type integer ); CREATE TABLE licenses ( @@ -1162,6 +1163,8 @@ CREATE INDEX index_good_job_jobs_for_candidate_lookup ON good_jobs USING btree ( CREATE UNIQUE INDEX index_good_job_settings_on_key ON good_job_settings USING btree (key); +CREATE INDEX index_good_jobs_for_candidate_dequeue_unlocked ON good_jobs USING btree (priority, scheduled_at, id) WHERE ((finished_at IS NULL) AND (locked_by_id IS NULL)); + CREATE INDEX index_good_jobs_jobs_on_finished_at_only ON good_jobs USING btree (finished_at) WHERE (finished_at IS NOT NULL); CREATE INDEX index_good_jobs_jobs_on_priority_created_at_when_unfinished ON good_jobs USING btree (priority DESC NULLS LAST, created_at) WHERE (finished_at IS NULL); @@ -1176,22 +1179,36 @@ CREATE INDEX index_good_jobs_on_concurrency_key_and_created_at ON good_jobs USIN CREATE INDEX index_good_jobs_on_concurrency_key_when_unfinished ON good_jobs USING btree (concurrency_key) WHERE (finished_at IS NULL); +CREATE INDEX index_good_jobs_on_created_at ON good_jobs USING btree (created_at); + CREATE INDEX index_good_jobs_on_cron_key_and_created_at_cond ON good_jobs USING btree (cron_key, created_at) WHERE (cron_key IS NOT NULL); CREATE UNIQUE INDEX index_good_jobs_on_cron_key_and_cron_at_cond ON good_jobs USING btree (cron_key, cron_at) WHERE (cron_key IS NOT NULL); +CREATE INDEX index_good_jobs_on_discarded ON good_jobs USING btree (finished_at DESC) WHERE ((finished_at IS NOT NULL) AND (error IS NOT NULL)); + CREATE INDEX index_good_jobs_on_job_class ON good_jobs USING btree (job_class); CREATE INDEX index_good_jobs_on_labels ON good_jobs USING gin (labels) WHERE (labels IS NOT NULL); CREATE INDEX index_good_jobs_on_locked_by_id ON good_jobs USING btree (locked_by_id) WHERE (locked_by_id IS NOT NULL); +CREATE INDEX index_good_jobs_on_priority_scheduled_at_unfinished ON good_jobs USING btree (priority, scheduled_at, id) WHERE (finished_at IS NULL); + CREATE INDEX index_good_jobs_on_priority_scheduled_at_unfinished_unlocked ON good_jobs USING btree (priority, scheduled_at) WHERE ((finished_at IS NULL) AND (locked_by_id IS NULL)); +CREATE INDEX index_good_jobs_on_queue_name ON good_jobs USING btree (queue_name); + CREATE INDEX index_good_jobs_on_queue_name_and_scheduled_at ON good_jobs USING btree (queue_name, scheduled_at) WHERE (finished_at IS NULL); +CREATE INDEX index_good_jobs_on_queue_name_priority_scheduled_at_unfinished ON good_jobs USING btree (queue_name, scheduled_at, id) WHERE (finished_at IS NULL); + CREATE INDEX index_good_jobs_on_scheduled_at ON good_jobs USING btree (scheduled_at) WHERE (finished_at IS NULL); +CREATE INDEX index_good_jobs_on_scheduled_at_and_queue_name ON good_jobs USING btree (scheduled_at, queue_name); + +CREATE INDEX index_good_jobs_on_unfinished_or_errored ON good_jobs USING btree (id) WHERE ((finished_at IS NULL) OR (error IS NOT NULL)); + CREATE INDEX index_licenses_on_namespace_id ON licenses USING btree (namespace_id); CREATE INDEX index_namespace_member_roles_on_member_id ON namespace_member_roles USING btree (member_id);