add solid queue

This commit is contained in:
2025-06-22 09:17:18 +02:00
parent 7c14e469c9
commit b368a750fe
13 changed files with 257 additions and 14 deletions

View File

@@ -21,8 +21,13 @@ default: &default
development:
<<: *default
database: plays_hub_development
primary:
<<: *default
database: plays_hub_development
queue:
<<: *default
database: plays_hub_development_queue
migrations_paths: db/queue_migrate
# The specified database role being used to connect to PostgreSQL.
# To create additional roles in PostgreSQL see `$ createuser --help`.
@@ -79,7 +84,13 @@ test:
# for a full overview on how database connection configuration can be specified.
#
production:
<<: *default
database: plays_hub_production
username: plays_hub
password: <%= ENV["PLAYS_HUB_DATABASE_PASSWORD"] %>
primary:
<<: *default
database: plays_hub_production
username: plays_hub
password: <%= ENV["PLAYS_HUB_DATABASE_PASSWORD"] %>
queue:
<<: *default
database: plays_hub_queue
username: plays_hub
password: <%= ENV["PLAYS_HUB_QUEUE_DATABASE_PASSWORD"] %>

View File

@@ -57,4 +57,8 @@ Rails.application.configure do
# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
# config.generators.apply_rubocop_autocorrect_after_generate!
#
#
config.active_job.queue_adapter = :solid_queue
config.solid_queue.connects_to = { database: { writing: :queue } }
end

View File

@@ -49,8 +49,11 @@ Rails.application.configure do
# Replace the default in-process memory cache store with a durable alternative.
# config.cache_store = :mem_cache_store
# Replace the default in-process and non-durable queuing backend for Active Job.
# config.active_job.queue_adapter = :resque
config.active_job.queue_adapter = :solid_queue
config.solid_queue.connects_to = { database: { writing: :queue } }
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).

18
config/queue.yml Normal file
View File

@@ -0,0 +1,18 @@
default: &default
dispatchers:
- polling_interval: 1
batch_size: 500
workers:
- queues: "*"
threads: 3
processes: <%= ENV.fetch("JOB_CONCURRENCY", 1) %>
polling_interval: 0.1
development:
<<: *default
test:
<<: *default
production:
<<: *default

10
config/recurring.yml Normal file
View File

@@ -0,0 +1,10 @@
# production:
# periodic_cleanup:
# class: CleanSoftDeletedRecordsJob
# queue: background
# args: [ 1000, { batch_size: 500 } ]
# schedule: every hour
# periodic_command:
# command: "SoftDeletedRecord.due.delete_all"
# priority: 2
# schedule: at 5am every day