chore: Fix connection pool (#6005)
We want to allocate as much database connection to the pool to match the sidekiq concurrency configuration. ref: https://maxencemalbois.medium.com/the-ruby-on-rails-database-connections-pool-4ce1099a9e9f fixes: #6004
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
default: &default
|
||||
adapter: postgresql
|
||||
encoding: unicode
|
||||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
||||
host: <%= ENV.fetch('POSTGRES_HOST', 'localhost') %>
|
||||
port: <%= ENV.fetch('POSTGRES_PORT', '5432') %>
|
||||
# ref: https://github.com/mperham/sidekiq/issues/2985#issuecomment-531097962
|
||||
pool: <%= Sidekiq.server? ? Sidekiq.options[:concurrency] : ENV.fetch('RAILS_MAX_THREADS', 5) %>
|
||||
|
||||
development:
|
||||
<<: *default
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# pick it up automatically.
|
||||
---
|
||||
:verbose: false
|
||||
:concurrency: 5
|
||||
:concurrency: <%= ENV.fetch("SIDEKIQ_CONCURRENCY", 5) %>
|
||||
:timeout: 25
|
||||
:max_retries: 3
|
||||
|
||||
@@ -30,6 +30,6 @@
|
||||
|
||||
# you can override concurrency based on environment
|
||||
production:
|
||||
:concurrency: 10
|
||||
:concurrency: <%= ENV.fetch("SIDEKIQ_CONCURRENCY", 10) %>
|
||||
staging:
|
||||
:concurrency: 5
|
||||
:concurrency: <%= ENV.fetch("SIDEKIQ_CONCURRENCY", 5) %>
|
||||
|
||||
Reference in New Issue
Block a user