mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-18 20:59:39 +02:00
Use Redis for ActiveJob and ActionCable (#2004)
* Use Redis for ActiveJob and ActionCable * Fix alwaysApply setting * Update queue names and weights * Tweak weights * Update job queues * Update docker setup guide * Remove deprecated upgrade columns from users table * Refactor Redis configuration for Sidekiq and caching in production environment * Add Sidekiq Sentry monitoring * queue naming fix * Clean up schema
This commit is contained in:
parent
a7db914005
commit
19cc63c8f4
75 changed files with 328 additions and 1684 deletions
|
@ -20,11 +20,5 @@ class CreateStockExchanges < ActiveRecord::Migration[7.2]
|
|||
add_index :stock_exchanges, :country
|
||||
add_index :stock_exchanges, :country_code
|
||||
add_index :stock_exchanges, :currency_code
|
||||
|
||||
reversible do |dir|
|
||||
dir.up do
|
||||
load Rails.root.join('db/seeds/exchanges.rb')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
14
db/migrate/20250318212559_remove_good_job.rb
Normal file
14
db/migrate/20250318212559_remove_good_job.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
class RemoveGoodJob < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
drop_table :good_job_batches
|
||||
drop_table :good_job_executions
|
||||
drop_table :good_job_processes
|
||||
drop_table :good_job_settings
|
||||
drop_table :good_jobs
|
||||
end
|
||||
|
||||
def down
|
||||
# Add the tables back if needed - see schema.rb for the full table definitions
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
6
db/migrate/20250319145426_remove_self_host_upgrades.rb
Normal file
6
db/migrate/20250319145426_remove_self_host_upgrades.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class RemoveSelfHostUpgrades < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
remove_column :users, :last_prompted_upgrade_commit_sha
|
||||
remove_column :users, :last_alerted_upgrade_commit_sha
|
||||
end
|
||||
end
|
92
db/schema.rb
generated
92
db/schema.rb
generated
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.2].define(version: 2025_03_16_122019) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2025_03_19_145426) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
enable_extension "plpgsql"
|
||||
|
@ -244,94 +244,6 @@ ActiveRecord::Schema[7.2].define(version: 2025_03_16_122019) do
|
|||
t.boolean "data_enrichment_enabled", default: false
|
||||
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"
|
||||
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"], 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 "impersonation_session_logs", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
|
||||
t.uuid "impersonation_session_id", null: false
|
||||
t.string "controller"
|
||||
|
@ -652,8 +564,6 @@ ActiveRecord::Schema[7.2].define(version: 2025_03_16_122019) do
|
|||
t.string "password_digest"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "last_prompted_upgrade_commit_sha"
|
||||
t.string "last_alerted_upgrade_commit_sha"
|
||||
t.string "role", default: "member", null: false
|
||||
t.boolean "active", default: true, null: false
|
||||
t.datetime "onboarded_at"
|
||||
|
|
0
db/seeds/.keep
Normal file
0
db/seeds/.keep
Normal file
|
@ -1,36 +0,0 @@
|
|||
# Load exchanges from YAML configuration
|
||||
exchanges_config = YAML.safe_load(
|
||||
File.read(Rails.root.join('config', 'exchanges.yml')),
|
||||
permitted_classes: [],
|
||||
permitted_symbols: [],
|
||||
aliases: true
|
||||
)
|
||||
|
||||
exchanges_config.each do |exchange|
|
||||
next unless exchange['mic'].present? # Skip any invalid entries
|
||||
|
||||
StockExchange.find_or_create_by!(mic: exchange['mic']) do |ex|
|
||||
ex.name = exchange['name']
|
||||
ex.acronym = exchange['acronym']
|
||||
ex.country = exchange['country']
|
||||
ex.country_code = exchange['country_code']
|
||||
ex.city = exchange['city']
|
||||
ex.website = exchange['website']
|
||||
|
||||
# Timezone details
|
||||
if exchange['timezone']
|
||||
ex.timezone_name = exchange['timezone']['timezone']
|
||||
ex.timezone_abbr = exchange['timezone']['abbr']
|
||||
ex.timezone_abbr_dst = exchange['timezone']['abbr_dst']
|
||||
end
|
||||
|
||||
# Currency details
|
||||
if exchange['currency']
|
||||
ex.currency_code = exchange['currency']['code']
|
||||
ex.currency_symbol = exchange['currency']['symbol']
|
||||
ex.currency_name = exchange['currency']['name']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
puts "Created #{StockExchange.count} stock exchanges"
|
Loading…
Add table
Add a link
Reference in a new issue