diff --git a/config/database.yml b/config/database.yml index 34acf2f19..7216e44dd 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,6 +1,9 @@ default: &default adapter: postgresql - pool: <%= ENV["DB_POOL"] || ENV['MAX_THREADS'] || 5 %> + # The db pool must contain at least one more connection than the number of threads. + # Each thread uses its own connection, and we need an additional connection used + # by the ActivityLogAudienceHelper + pool: <%= ENV["DB_POOL"] || ENV.fetch('MAX_THREADS', 5).to_i + 1 %> timeout: 5000 connect_timeout: 15 encoding: unicode