diff --git a/Gemfile.lock b/Gemfile.lock index 27123c1d906..fdc31fe3428 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -213,7 +213,7 @@ GEM coderay (1.1.3) coercible (1.0.0) descendants_tracker (~> 0.0.1) - concurrent-ruby (1.1.10) + concurrent-ruby (1.2.0) connection_pool (2.2.5) cose (1.3.0) cbor (~> 0.5.9) @@ -287,15 +287,15 @@ GEM rake formatador (0.2.5) foundation_emails (2.2.1.0) - fugit (1.8.0) + fugit (1.8.1) et-orbi (~> 1, >= 1.2.7) raabro (~> 1.4) geocoder (1.7.0) get_process_mem (0.2.7) ffi (~> 1.0) - globalid (1.0.1) + globalid (1.1.0) activesupport (>= 5.0) - good_job (3.7.2) + good_job (3.12.3) activejob (>= 6.0.0) activerecord (>= 6.0.0) concurrent-ruby (>= 1.0.2) @@ -412,7 +412,7 @@ GEM net-ssh (6.1.0) newrelic_rpm (8.15.0) nio4r (2.5.8) - nokogiri (1.14.0) + nokogiri (1.14.2) mini_portile2 (~> 2.8.0) racc (~> 1.4) notiffany (0.1.3) @@ -502,7 +502,7 @@ GEM activesupport (>= 4.2) choice (~> 0.2.0) ruby-graphviz (~> 1.2) - rails-html-sanitizer (1.4.4) + rails-html-sanitizer (1.5.0) loofah (~> 2.19, >= 2.19.1) rails-i18n (7.0.6) i18n (>= 0.7, < 2) @@ -652,7 +652,7 @@ GEM bindata (~> 2.4) openssl (> 2.0, < 3.1) openssl-signature_algorithm (~> 1.0) - tzinfo (2.0.5) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) @@ -710,7 +710,7 @@ GEM nokogiri (~> 1.8) yard (0.9.28) webrick (~> 1.7.0) - zeitwerk (2.6.6) + zeitwerk (2.6.7) zonebie (0.6.1) zxcvbn (0.1.9) diff --git a/config/application.rb b/config/application.rb index a1bfbecfdc8..4d94003cd76 100644 --- a/config/application.rb +++ b/config/application.rb @@ -72,6 +72,7 @@ class Application < Rails::Application config.good_job.max_threads = IdentityConfig.store.good_job_max_threads config.good_job.queues = IdentityConfig.store.good_job_queues config.good_job.preserve_job_records = false + config.good_job.enable_listen_notify = false config.good_job.queue_select_limit = IdentityConfig.store.good_job_queue_select_limit # see config/initializers/job_configurations.rb for cron schedule diff --git a/db/worker_jobs_migrate/20230221201647_create_good_job_batches.rb b/db/worker_jobs_migrate/20230221201647_create_good_job_batches.rb new file mode 100644 index 00000000000..27f4e7cdcfe --- /dev/null +++ b/db/worker_jobs_migrate/20230221201647_create_good_job_batches.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true +class CreateGoodJobBatches < ActiveRecord::Migration[7.0] + def change + reversible do |dir| + dir.up do + # Ensure this incremental update migration is idempotent + # with monolithic install migration. + return if connection.table_exists?(:good_job_batches) + end + end + + create_table :good_job_batches, id: :uuid do |t| + t.timestamps + t.text :description + t.jsonb :serialized_properties + t.text :on_finish + t.text :on_success + t.text :on_discard + t.text :callback_queue_name + t.integer :callback_priority + t.datetime :enqueued_at + t.datetime :discarded_at + t.datetime :finished_at + end + + safety_assured do + change_table :good_jobs do |t| + t.uuid :batch_id + t.uuid :batch_callback_id + + t.index :batch_id, where: "batch_id IS NOT NULL" + t.index :batch_callback_id, where: "batch_callback_id IS NOT NULL" + end + end + end +end diff --git a/db/worker_jobs_schema.rb b/db/worker_jobs_schema.rb index c2b8b43af2c..9e5fe51c074 100644 --- a/db/worker_jobs_schema.rb +++ b/db/worker_jobs_schema.rb @@ -10,11 +10,26 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2022_10_24_144708) do +ActiveRecord::Schema[7.0].define(version: 2023_02_21_201647) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" + create_table "good_job_batches", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.text "description" + t.jsonb "serialized_properties" + t.text "on_finish" + t.text "on_success" + t.text "on_discard" + t.text "callback_queue_name" + t.integer "callback_priority" + t.datetime "enqueued_at" + t.datetime "discarded_at" + t.datetime "finished_at" + end + create_table "good_job_processes", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -44,8 +59,12 @@ t.text "cron_key" t.uuid "retried_good_job_id" t.datetime "cron_at", precision: nil + t.uuid "batch_id" + t.uuid "batch_callback_id" t.index ["active_job_id", "created_at"], name: "index_good_jobs_on_active_job_id_and_created_at" t.index ["active_job_id"], name: "index_good_jobs_on_active_job_id" + t.index ["batch_callback_id"], name: "index_good_jobs_on_batch_callback_id", where: "(batch_callback_id IS NOT NULL)" + t.index ["batch_id"], name: "index_good_jobs_on_batch_id", where: "(batch_id IS NOT NULL)" t.index ["concurrency_key"], name: "index_good_jobs_on_concurrency_key_when_unfinished", where: "(finished_at IS NULL)" t.index ["cron_key", "created_at"], name: "index_good_jobs_on_cron_key_and_created_at" t.index ["cron_key", "cron_at"], name: "index_good_jobs_on_cron_key_and_cron_at", unique: true