1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-05 13:35:21 +02:00

Adjust queues to prioritize account syncs (#1682)

This commit is contained in:
Zach Gollwitzer 2025-01-24 13:39:08 -05:00 committed by GitHub
parent 7d04ea1071
commit 3140835f28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 37 additions and 12 deletions

View file

@ -1,7 +1,8 @@
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
# 3 connections for Puma, 8 for GoodJob (in async mode, the default for self-hosters) = 11 connections
pool: <%= ENV.fetch("DB_POOL_SIZE") { 11 } %>
host: <%= ENV.fetch("DB_HOST") { "127.0.0.1" } %>
port: <%= ENV.fetch("DB_PORT") { "5432" } %>
user: <%= ENV.fetch("POSTGRES_USER") { nil } %>

View file

@ -11,6 +11,14 @@ Rails.application.configure do
}
end
# 5 queue threads + 3 for job listener, cron, executor = 8 threads allocated
config.queues = {
"latency_low" => { max_threads: 1, priority: 10 }, # ~30s jobs
"latency_low,latency_medium" => { max_threads: 2, priority: 5 }, # ~1-2 min jobs
"latency_low,latency_medium,latency_high" => { max_threads: 1, priority: 1 }, # ~5+ min jobs
"*" => { max_threads: 1, priority: 0 } # fallback queue
}
# Auth for jobs admin dashboard
ActiveSupport.on_load(:good_job_application_controller) do
before_action do