Add Solid Queue
This commit is contained in:
parent
d00bde60b1
commit
ea31c03c44
2
Gemfile
2
Gemfile
|
@ -17,6 +17,8 @@ gem "tzinfo-data", platforms: %i[ windows jruby ]
|
||||||
gem "bootsnap", require: false
|
gem "bootsnap", require: false
|
||||||
# gem "image_processing", "~> 1.2"
|
# gem "image_processing", "~> 1.2"
|
||||||
|
|
||||||
|
gem "solid_queue"
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
gem "debug", platforms: %i[ mri windows ]
|
gem "debug", platforms: %i[ mri windows ]
|
||||||
end
|
end
|
||||||
|
|
13
Gemfile.lock
13
Gemfile.lock
|
@ -103,6 +103,11 @@ GEM
|
||||||
reline (>= 0.3.8)
|
reline (>= 0.3.8)
|
||||||
drb (2.2.1)
|
drb (2.2.1)
|
||||||
erubi (1.12.0)
|
erubi (1.12.0)
|
||||||
|
et-orbi (1.2.11)
|
||||||
|
tzinfo
|
||||||
|
fugit (1.10.1)
|
||||||
|
et-orbi (~> 1, >= 1.2.7)
|
||||||
|
raabro (~> 1.4)
|
||||||
globalid (1.2.1)
|
globalid (1.2.1)
|
||||||
activesupport (>= 6.1)
|
activesupport (>= 6.1)
|
||||||
i18n (1.14.5)
|
i18n (1.14.5)
|
||||||
|
@ -171,6 +176,7 @@ GEM
|
||||||
public_suffix (5.0.5)
|
public_suffix (5.0.5)
|
||||||
puma (6.4.2)
|
puma (6.4.2)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
|
raabro (1.4.0)
|
||||||
racc (1.8.0)
|
racc (1.8.0)
|
||||||
rack (3.0.11)
|
rack (3.0.11)
|
||||||
rack-session (2.0.0)
|
rack-session (2.0.0)
|
||||||
|
@ -254,6 +260,12 @@ GEM
|
||||||
rexml (~> 3.2, >= 3.2.5)
|
rexml (~> 3.2, >= 3.2.5)
|
||||||
rubyzip (>= 1.2.2, < 3.0)
|
rubyzip (>= 1.2.2, < 3.0)
|
||||||
websocket (~> 1.0)
|
websocket (~> 1.0)
|
||||||
|
solid_queue (0.3.1)
|
||||||
|
activejob (>= 7.1)
|
||||||
|
activerecord (>= 7.1)
|
||||||
|
concurrent-ruby (~> 1.2.2)
|
||||||
|
fugit (~> 1.10.1)
|
||||||
|
railties (>= 7.1)
|
||||||
stimulus-rails (1.3.3)
|
stimulus-rails (1.3.3)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
stringio (3.1.0)
|
stringio (3.1.0)
|
||||||
|
@ -302,6 +314,7 @@ DEPENDENCIES
|
||||||
rails (~> 7.1.3, >= 7.1.3.2)
|
rails (~> 7.1.3, >= 7.1.3.2)
|
||||||
rubocop-rails-omakase
|
rubocop-rails-omakase
|
||||||
selenium-webdriver
|
selenium-webdriver
|
||||||
|
solid_queue
|
||||||
stimulus-rails
|
stimulus-rails
|
||||||
turbo-rails
|
turbo-rails
|
||||||
tzinfo-data
|
tzinfo-data
|
||||||
|
|
|
@ -70,7 +70,7 @@ Rails.application.configure do
|
||||||
# config.cache_store = :mem_cache_store
|
# config.cache_store = :mem_cache_store
|
||||||
|
|
||||||
# Use a real queuing backend for Active Job (and separate queues per environment).
|
# Use a real queuing backend for Active Job (and separate queues per environment).
|
||||||
# config.active_job.queue_adapter = :resque
|
config.active_job.queue_adapter = :solid_queue
|
||||||
# config.active_job.queue_name_prefix = "forg_production"
|
# config.active_job.queue_name_prefix = "forg_production"
|
||||||
|
|
||||||
config.action_mailer.perform_caching = false
|
config.action_mailer.perform_caching = false
|
||||||
|
|
|
@ -35,3 +35,5 @@ pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
|
||||||
|
|
||||||
# Allow puma to be restarted by `bin/rails restart` command.
|
# Allow puma to be restarted by `bin/rails restart` command.
|
||||||
plugin :tmp_restart
|
plugin :tmp_restart
|
||||||
|
|
||||||
|
plugin :solid_queue if Rails.env.production?
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
# default: &default
|
||||||
|
# dispatchers:
|
||||||
|
# - polling_interval: 1
|
||||||
|
# batch_size: 500
|
||||||
|
# workers:
|
||||||
|
# - queues: "*"
|
||||||
|
# threads: 3
|
||||||
|
# processes: 1
|
||||||
|
# polling_interval: 0.1
|
||||||
|
#
|
||||||
|
# development:
|
||||||
|
# <<: *default
|
||||||
|
#
|
||||||
|
# test:
|
||||||
|
# <<: *default
|
||||||
|
#
|
||||||
|
# production:
|
||||||
|
# <<: *default
|
|
@ -0,0 +1,103 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# This migration comes from solid_queue (originally 20231211200639)
|
||||||
|
class CreateSolidQueueTables < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
create_table :solid_queue_jobs do |t|
|
||||||
|
t.string :queue_name, null: false
|
||||||
|
t.string :class_name, null: false, index: true
|
||||||
|
t.text :arguments
|
||||||
|
t.integer :priority, default: 0, null: false
|
||||||
|
t.string :active_job_id, index: true
|
||||||
|
t.datetime :scheduled_at
|
||||||
|
t.datetime :finished_at, index: true
|
||||||
|
t.string :concurrency_key
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
|
||||||
|
t.index [ :queue_name, :finished_at ], name: "index_solid_queue_jobs_for_filtering"
|
||||||
|
t.index [ :scheduled_at, :finished_at ], name: "index_solid_queue_jobs_for_alerting"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :solid_queue_scheduled_executions do |t|
|
||||||
|
t.references :job, index: { unique: true }, null: false
|
||||||
|
t.string :queue_name, null: false
|
||||||
|
t.integer :priority, default: 0, null: false
|
||||||
|
t.datetime :scheduled_at, null: false
|
||||||
|
|
||||||
|
t.datetime :created_at, null: false
|
||||||
|
|
||||||
|
t.index [ :scheduled_at, :priority, :job_id ], name: "index_solid_queue_dispatch_all"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :solid_queue_ready_executions do |t|
|
||||||
|
t.references :job, index: { unique: true }, null: false
|
||||||
|
t.string :queue_name, null: false
|
||||||
|
t.integer :priority, default: 0, null: false
|
||||||
|
|
||||||
|
t.datetime :created_at, null: false
|
||||||
|
|
||||||
|
t.index [ :priority, :job_id ], name: "index_solid_queue_poll_all"
|
||||||
|
t.index [ :queue_name, :priority, :job_id ], name: "index_solid_queue_poll_by_queue"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :solid_queue_claimed_executions do |t|
|
||||||
|
t.references :job, index: { unique: true }, null: false
|
||||||
|
t.bigint :process_id
|
||||||
|
t.datetime :created_at, null: false
|
||||||
|
|
||||||
|
t.index [ :process_id, :job_id ]
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :solid_queue_blocked_executions do |t|
|
||||||
|
t.references :job, index: { unique: true }, null: false
|
||||||
|
t.string :queue_name, null: false
|
||||||
|
t.integer :priority, default: 0, null: false
|
||||||
|
t.string :concurrency_key, null: false
|
||||||
|
t.datetime :expires_at, null: false
|
||||||
|
|
||||||
|
t.datetime :created_at, null: false
|
||||||
|
|
||||||
|
t.index [ :expires_at, :concurrency_key ], name: "index_solid_queue_blocked_executions_for_maintenance"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :solid_queue_failed_executions do |t|
|
||||||
|
t.references :job, index: { unique: true }, null: false
|
||||||
|
t.text :error
|
||||||
|
t.datetime :created_at, null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :solid_queue_pauses do |t|
|
||||||
|
t.string :queue_name, null: false, index: { unique: true }
|
||||||
|
t.datetime :created_at, null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :solid_queue_processes do |t|
|
||||||
|
t.string :kind, null: false
|
||||||
|
t.datetime :last_heartbeat_at, null: false, index: true
|
||||||
|
t.bigint :supervisor_id, index: true
|
||||||
|
|
||||||
|
t.integer :pid, null: false
|
||||||
|
t.string :hostname
|
||||||
|
t.text :metadata
|
||||||
|
|
||||||
|
t.datetime :created_at, null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table :solid_queue_semaphores do |t|
|
||||||
|
t.string :key, null: false, index: { unique: true }
|
||||||
|
t.integer :value, default: 1, null: false
|
||||||
|
t.datetime :expires_at, null: false, index: true
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
|
||||||
|
t.index [ :key, :value ], name: "index_solid_queue_semaphores_on_key_and_value"
|
||||||
|
end
|
||||||
|
|
||||||
|
add_foreign_key :solid_queue_blocked_executions, :solid_queue_jobs, column: :job_id, on_delete: :cascade
|
||||||
|
add_foreign_key :solid_queue_claimed_executions, :solid_queue_jobs, column: :job_id, on_delete: :cascade
|
||||||
|
add_foreign_key :solid_queue_failed_executions, :solid_queue_jobs, column: :job_id, on_delete: :cascade
|
||||||
|
add_foreign_key :solid_queue_ready_executions, :solid_queue_jobs, column: :job_id, on_delete: :cascade
|
||||||
|
add_foreign_key :solid_queue_scheduled_executions, :solid_queue_jobs, column: :job_id, on_delete: :cascade
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,8 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# This migration comes from solid_queue (originally 20240110143450)
|
||||||
|
class AddMissingIndexToBlockedExecutions < ActiveRecord::Migration[7.1]
|
||||||
|
def change
|
||||||
|
add_index :solid_queue_blocked_executions, [ :concurrency_key, :priority, :job_id ], name: "index_solid_queue_blocked_executions_for_release"
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,17 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# This migration comes from solid_queue (originally 20240218110712)
|
||||||
|
class CreateRecurringExecutions < ActiveRecord::Migration[7.1]
|
||||||
|
def change
|
||||||
|
create_table :solid_queue_recurring_executions do |t|
|
||||||
|
t.references :job, index: { unique: true }, null: false
|
||||||
|
t.string :task_key, null: false
|
||||||
|
t.datetime :run_at, null: false
|
||||||
|
t.datetime :created_at, null: false
|
||||||
|
|
||||||
|
t.index [ :task_key, :run_at ], unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
add_foreign_key :solid_queue_recurring_executions, :solid_queue_jobs, column: :job_id, on_delete: :cascade
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# 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[7.1].define(version: 2024_05_29_122012) do
|
ActiveRecord::Schema[7.1].define(version: 2024_05_30_071707) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
||||||
|
@ -44,6 +44,109 @@ ActiveRecord::Schema[7.1].define(version: 2024_05_29_122012) do
|
||||||
t.index ["user_id"], name: "index_site_roles_users_on_user_id"
|
t.index ["user_id"], name: "index_site_roles_users_on_user_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_blocked_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.string "concurrency_key", null: false
|
||||||
|
t.datetime "expires_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["concurrency_key", "priority", "job_id"], name: "index_solid_queue_blocked_executions_for_release"
|
||||||
|
t.index ["expires_at", "concurrency_key"], name: "index_solid_queue_blocked_executions_for_maintenance"
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_blocked_executions_on_job_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_claimed_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.bigint "process_id"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_claimed_executions_on_job_id", unique: true
|
||||||
|
t.index ["process_id", "job_id"], name: "index_solid_queue_claimed_executions_on_process_id_and_job_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_failed_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.text "error"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_failed_executions_on_job_id", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_jobs", force: :cascade do |t|
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.string "class_name", null: false
|
||||||
|
t.text "arguments"
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.string "active_job_id"
|
||||||
|
t.datetime "scheduled_at"
|
||||||
|
t.datetime "finished_at"
|
||||||
|
t.string "concurrency_key"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["active_job_id"], name: "index_solid_queue_jobs_on_active_job_id"
|
||||||
|
t.index ["class_name"], name: "index_solid_queue_jobs_on_class_name"
|
||||||
|
t.index ["finished_at"], name: "index_solid_queue_jobs_on_finished_at"
|
||||||
|
t.index ["queue_name", "finished_at"], name: "index_solid_queue_jobs_for_filtering"
|
||||||
|
t.index ["scheduled_at", "finished_at"], name: "index_solid_queue_jobs_for_alerting"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_pauses", force: :cascade do |t|
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["queue_name"], name: "index_solid_queue_pauses_on_queue_name", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_processes", force: :cascade do |t|
|
||||||
|
t.string "kind", null: false
|
||||||
|
t.datetime "last_heartbeat_at", null: false
|
||||||
|
t.bigint "supervisor_id"
|
||||||
|
t.integer "pid", null: false
|
||||||
|
t.string "hostname"
|
||||||
|
t.text "metadata"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["last_heartbeat_at"], name: "index_solid_queue_processes_on_last_heartbeat_at"
|
||||||
|
t.index ["supervisor_id"], name: "index_solid_queue_processes_on_supervisor_id"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_ready_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_ready_executions_on_job_id", unique: true
|
||||||
|
t.index ["priority", "job_id"], name: "index_solid_queue_poll_all"
|
||||||
|
t.index ["queue_name", "priority", "job_id"], name: "index_solid_queue_poll_by_queue"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_recurring_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "task_key", null: false
|
||||||
|
t.datetime "run_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_recurring_executions_on_job_id", unique: true
|
||||||
|
t.index ["task_key", "run_at"], name: "index_solid_queue_recurring_executions_on_task_key_and_run_at", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_scheduled_executions", force: :cascade do |t|
|
||||||
|
t.bigint "job_id", null: false
|
||||||
|
t.string "queue_name", null: false
|
||||||
|
t.integer "priority", default: 0, null: false
|
||||||
|
t.datetime "scheduled_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.index ["job_id"], name: "index_solid_queue_scheduled_executions_on_job_id", unique: true
|
||||||
|
t.index ["scheduled_at", "priority", "job_id"], name: "index_solid_queue_dispatch_all"
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "solid_queue_semaphores", force: :cascade do |t|
|
||||||
|
t.string "key", null: false
|
||||||
|
t.integer "value", default: 1, null: false
|
||||||
|
t.datetime "expires_at", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
t.index ["expires_at"], name: "index_solid_queue_semaphores_on_expires_at"
|
||||||
|
t.index ["key", "value"], name: "index_solid_queue_semaphores_on_key_and_value"
|
||||||
|
t.index ["key"], name: "index_solid_queue_semaphores_on_key", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
create_table "table_invites", force: :cascade do |t|
|
create_table "table_invites", force: :cascade do |t|
|
||||||
t.bigint "table_id", null: false
|
t.bigint "table_id", null: false
|
||||||
t.string "email", null: false
|
t.string "email", null: false
|
||||||
|
@ -90,6 +193,12 @@ ActiveRecord::Schema[7.1].define(version: 2024_05_29_122012) do
|
||||||
|
|
||||||
add_foreign_key "players", "tables"
|
add_foreign_key "players", "tables"
|
||||||
add_foreign_key "players", "users"
|
add_foreign_key "players", "users"
|
||||||
|
add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_ready_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
|
add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
|
||||||
add_foreign_key "table_invites", "tables"
|
add_foreign_key "table_invites", "tables"
|
||||||
add_foreign_key "tables", "game_systems"
|
add_foreign_key "tables", "game_systems"
|
||||||
add_foreign_key "tables", "users", column: "owner_id"
|
add_foreign_key "tables", "users", column: "owner_id"
|
||||||
|
|
1
todo.md
1
todo.md
|
@ -1,6 +1,5 @@
|
||||||
- user page, avatar, profile description
|
- user page, avatar, profile description
|
||||||
- list invites on user page
|
- list invites on user page
|
||||||
- allow inviting non-users
|
|
||||||
- notifications
|
- notifications
|
||||||
- Add characters to users/tables
|
- Add characters to users/tables
|
||||||
- Character sheets/prototypes
|
- Character sheets/prototypes
|
||||||
|
|
Loading…
Reference in New Issue