mirror of
https://github.com/System-End/highway.git
synced 2026-04-19 16:28:24 +00:00
Switch to goodjob
This commit is contained in:
parent
1eb2523d48
commit
6a134e3def
5 changed files with 209 additions and 2 deletions
2
Gemfile
2
Gemfile
|
|
@ -85,3 +85,5 @@ gem "awesome_print", "~> 1.9"
|
||||||
|
|
||||||
# Environment variables
|
# Environment variables
|
||||||
gem "dotenv-rails", groups: [ :development, :test ]
|
gem "dotenv-rails", groups: [ :development, :test ]
|
||||||
|
|
||||||
|
gem "good_job", "~> 4.10"
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,13 @@ GEM
|
||||||
raabro (~> 1.4)
|
raabro (~> 1.4)
|
||||||
globalid (1.2.1)
|
globalid (1.2.1)
|
||||||
activesupport (>= 6.1)
|
activesupport (>= 6.1)
|
||||||
|
good_job (4.10.0)
|
||||||
|
activejob (>= 6.1.0)
|
||||||
|
activerecord (>= 6.1.0)
|
||||||
|
concurrent-ruby (>= 1.3.1)
|
||||||
|
fugit (>= 1.11.0)
|
||||||
|
railties (>= 6.1.0)
|
||||||
|
thor (>= 1.0.0)
|
||||||
i18n (1.14.7)
|
i18n (1.14.7)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
image_processing (1.14.0)
|
image_processing (1.14.0)
|
||||||
|
|
@ -445,6 +452,7 @@ DEPENDENCIES
|
||||||
debug
|
debug
|
||||||
dotenv
|
dotenv
|
||||||
dotenv-rails
|
dotenv-rails
|
||||||
|
good_job (~> 4.10)
|
||||||
image_processing (~> 1.2)
|
image_processing (~> 1.2)
|
||||||
importmap-rails
|
importmap-rails
|
||||||
jbuilder
|
jbuilder
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ Rails.application.configure do
|
||||||
config.cache_store = :solid_cache_store
|
config.cache_store = :solid_cache_store
|
||||||
|
|
||||||
# Replace the default in-process and non-durable queuing backend for Active Job.
|
# Replace the default in-process and non-durable queuing backend for Active Job.
|
||||||
config.active_job.queue_adapter = :solid_queue
|
config.active_job.queue_adapter = :good_job
|
||||||
config.solid_queue.connects_to = { database: { writing: :queue } }
|
config.solid_queue.connects_to = { database: { writing: :queue } }
|
||||||
|
|
||||||
# Ignore bad email addresses and do not raise email delivery errors.
|
# Ignore bad email addresses and do not raise email delivery errors.
|
||||||
|
|
|
||||||
104
db/migrate/20250513161944_create_good_jobs.rb
Normal file
104
db/migrate/20250513161944_create_good_jobs.rb
Normal file
|
|
@ -0,0 +1,104 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class CreateGoodJobs < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
# Uncomment for Postgres v12 or earlier to enable gen_random_uuid() support
|
||||||
|
# enable_extension 'pgcrypto'
|
||||||
|
|
||||||
|
create_table :good_jobs, id: :uuid do |t|
|
||||||
|
t.text :queue_name
|
||||||
|
t.integer :priority
|
||||||
|
t.jsonb :serialized_params
|
||||||
|
t.datetime :scheduled_at
|
||||||
|
t.datetime :performed_at
|
||||||
|
t.datetime :finished_at
|
||||||
|
t.text :error
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
|
||||||
|
t.uuid :active_job_id
|
||||||
|
t.text :concurrency_key
|
||||||
|
t.text :cron_key
|
||||||
|
t.uuid :retried_good_job_id
|
||||||
|
t.datetime :cron_at
|
||||||
|
|
||||||
|
t.uuid :batch_id
|
||||||
|
t.uuid :batch_callback_id
|
||||||
|
|
||||||
|
t.boolean :is_discrete
|
||||||
|
t.integer :executions_count
|
||||||
|
t.text :job_class
|
||||||
|
t.integer :error_event, limit: 2
|
||||||
|
t.text :labels, array: true
|
||||||
|
t.uuid :locked_by_id
|
||||||
|
t.datetime :locked_at
|
||||||
|
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
|
||||||
|
t.datetime :jobs_finished_at
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :good_job_executions, id: :uuid do |t|
|
||||||
|
t.timestamps
|
||||||
|
|
||||||
|
t.uuid :active_job_id, null: false
|
||||||
|
t.text :job_class
|
||||||
|
t.text :queue_name
|
||||||
|
t.jsonb :serialized_params
|
||||||
|
t.datetime :scheduled_at
|
||||||
|
t.datetime :finished_at
|
||||||
|
t.text :error
|
||||||
|
t.integer :error_event, limit: 2
|
||||||
|
t.text :error_backtrace, array: true
|
||||||
|
t.uuid :process_id
|
||||||
|
t.interval :duration
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :good_job_processes, id: :uuid do |t|
|
||||||
|
t.timestamps
|
||||||
|
t.jsonb :state
|
||||||
|
t.integer :lock_type, limit: 2
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :good_job_settings, id: :uuid do |t|
|
||||||
|
t.timestamps
|
||||||
|
t.text :key
|
||||||
|
t.jsonb :value
|
||||||
|
t.index :key, unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index :good_jobs, :scheduled_at, where: "(finished_at IS NULL)", name: :index_good_jobs_on_scheduled_at
|
||||||
|
add_index :good_jobs, [:queue_name, :scheduled_at], where: "(finished_at IS NULL)", name: :index_good_jobs_on_queue_name_and_scheduled_at
|
||||||
|
add_index :good_jobs, [:active_job_id, :created_at], name: :index_good_jobs_on_active_job_id_and_created_at
|
||||||
|
add_index :good_jobs, :concurrency_key, where: "(finished_at IS NULL)", name: :index_good_jobs_on_concurrency_key_when_unfinished
|
||||||
|
add_index :good_jobs, [:concurrency_key, :created_at], name: :index_good_jobs_on_concurrency_key_and_created_at
|
||||||
|
add_index :good_jobs, [:cron_key, :created_at], where: "(cron_key IS NOT NULL)", name: :index_good_jobs_on_cron_key_and_created_at_cond
|
||||||
|
add_index :good_jobs, [:cron_key, :cron_at], where: "(cron_key IS NOT NULL)", unique: true, name: :index_good_jobs_on_cron_key_and_cron_at_cond
|
||||||
|
add_index :good_jobs, [:finished_at], where: "retried_good_job_id IS NULL AND finished_at IS NOT NULL", name: :index_good_jobs_jobs_on_finished_at
|
||||||
|
add_index :good_jobs, [:priority, :created_at], order: { priority: "DESC NULLS LAST", created_at: :asc },
|
||||||
|
where: "finished_at IS NULL", name: :index_good_jobs_jobs_on_priority_created_at_when_unfinished
|
||||||
|
add_index :good_jobs, [:priority, :created_at], order: { priority: "ASC NULLS LAST", created_at: :asc },
|
||||||
|
where: "finished_at IS NULL", name: :index_good_job_jobs_for_candidate_lookup
|
||||||
|
add_index :good_jobs, [:batch_id], where: "batch_id IS NOT NULL"
|
||||||
|
add_index :good_jobs, [:batch_callback_id], where: "batch_callback_id IS NOT NULL"
|
||||||
|
add_index :good_jobs, :labels, using: :gin, where: "(labels IS NOT NULL)", name: :index_good_jobs_on_labels
|
||||||
|
|
||||||
|
add_index :good_job_executions, [:active_job_id, :created_at], name: :index_good_job_executions_on_active_job_id_and_created_at
|
||||||
|
add_index :good_jobs, [:priority, :scheduled_at], order: { priority: "ASC NULLS LAST", scheduled_at: :asc },
|
||||||
|
where: "finished_at IS NULL AND locked_by_id IS NULL", name: :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked
|
||||||
|
add_index :good_jobs, :locked_by_id,
|
||||||
|
where: "locked_by_id IS NOT NULL", name: "index_good_jobs_on_locked_by_id"
|
||||||
|
add_index :good_job_executions, [:process_id, :created_at], name: :index_good_job_executions_on_process_id_and_created_at
|
||||||
|
end
|
||||||
|
end
|
||||||
95
db/schema.rb
generated
95
db/schema.rb
generated
|
|
@ -10,7 +10,10 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[8.0].define(version: 2025_05_08_185907) do
|
ActiveRecord::Schema[8.0].define(version: 2025_05_13_161944) do
|
||||||
|
# These are extensions that must be enabled in order to support this database
|
||||||
|
enable_extension "pg_catalog.plpgsql"
|
||||||
|
|
||||||
create_table "action_text_rich_texts", force: :cascade do |t|
|
create_table "action_text_rich_texts", force: :cascade do |t|
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
t.text "body"
|
t.text "body"
|
||||||
|
|
@ -49,6 +52,96 @@ ActiveRecord::Schema[8.0].define(version: 2025_05_08_185907) do
|
||||||
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
|
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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"
|
||||||
|
t.datetime "jobs_finished_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "good_job_executions", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.uuid "active_job_id", null: false
|
||||||
|
t.text "job_class"
|
||||||
|
t.text "queue_name"
|
||||||
|
t.jsonb "serialized_params"
|
||||||
|
t.datetime "scheduled_at"
|
||||||
|
t.datetime "finished_at"
|
||||||
|
t.text "error"
|
||||||
|
t.integer "error_event", limit: 2
|
||||||
|
t.text "error_backtrace", array: true
|
||||||
|
t.uuid "process_id"
|
||||||
|
t.interval "duration"
|
||||||
|
t.index ["active_job_id", "created_at"], name: "index_good_job_executions_on_active_job_id_and_created_at"
|
||||||
|
t.index ["process_id", "created_at"], name: "index_good_job_executions_on_process_id_and_created_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
|
||||||
|
t.jsonb "state"
|
||||||
|
t.integer "lock_type", limit: 2
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "good_job_settings", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.text "key"
|
||||||
|
t.jsonb "value"
|
||||||
|
t.index ["key"], name: "index_good_job_settings_on_key", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "good_jobs", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||||
|
t.text "queue_name"
|
||||||
|
t.integer "priority"
|
||||||
|
t.jsonb "serialized_params"
|
||||||
|
t.datetime "scheduled_at"
|
||||||
|
t.datetime "performed_at"
|
||||||
|
t.datetime "finished_at"
|
||||||
|
t.text "error"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.uuid "active_job_id"
|
||||||
|
t.text "concurrency_key"
|
||||||
|
t.text "cron_key"
|
||||||
|
t.uuid "retried_good_job_id"
|
||||||
|
t.datetime "cron_at"
|
||||||
|
t.uuid "batch_id"
|
||||||
|
t.uuid "batch_callback_id"
|
||||||
|
t.boolean "is_discrete"
|
||||||
|
t.integer "executions_count"
|
||||||
|
t.text "job_class"
|
||||||
|
t.integer "error_event", limit: 2
|
||||||
|
t.text "labels", array: true
|
||||||
|
t.uuid "locked_by_id"
|
||||||
|
t.datetime "locked_at"
|
||||||
|
t.index ["active_job_id", "created_at"], name: "index_good_jobs_on_active_job_id_and_created_at"
|
||||||
|
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", "created_at"], name: "index_good_jobs_on_concurrency_key_and_created_at"
|
||||||
|
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_cond", where: "(cron_key IS NOT NULL)"
|
||||||
|
t.index ["cron_key", "cron_at"], name: "index_good_jobs_on_cron_key_and_cron_at_cond", unique: true, where: "(cron_key IS NOT NULL)"
|
||||||
|
t.index ["finished_at"], name: "index_good_jobs_jobs_on_finished_at", where: "((retried_good_job_id IS NULL) AND (finished_at IS NOT NULL))"
|
||||||
|
t.index ["labels"], name: "index_good_jobs_on_labels", where: "(labels IS NOT NULL)", using: :gin
|
||||||
|
t.index ["locked_by_id"], name: "index_good_jobs_on_locked_by_id", where: "(locked_by_id IS NOT NULL)"
|
||||||
|
t.index ["priority", "created_at"], name: "index_good_job_jobs_for_candidate_lookup", where: "(finished_at IS NULL)"
|
||||||
|
t.index ["priority", "created_at"], name: "index_good_jobs_jobs_on_priority_created_at_when_unfinished", order: { priority: "DESC NULLS LAST" }, where: "(finished_at IS NULL)"
|
||||||
|
t.index ["priority", "scheduled_at"], name: "index_good_jobs_on_priority_scheduled_at_unfinished_unlocked", where: "((finished_at IS NULL) AND (locked_by_id IS NULL))"
|
||||||
|
t.index ["queue_name", "scheduled_at"], name: "index_good_jobs_on_queue_name_and_scheduled_at", where: "(finished_at IS NULL)"
|
||||||
|
t.index ["scheduled_at"], name: "index_good_jobs_on_scheduled_at", where: "(finished_at IS NULL)"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "rsvps", force: :cascade do |t|
|
create_table "rsvps", force: :cascade do |t|
|
||||||
t.string "email"
|
t.string "email"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue