Skip to content

Commit

Permalink
chore: config database timeout for production (#2035)
Browse files Browse the repository at this point in the history
Signed-off-by: Miles Zhang <mingchang555@hotmail.com>
  • Loading branch information
zmcNotafraid authored Jul 15, 2024
1 parent 2d452cd commit 1295066
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ default: &default
# http://guides.rubyonrails.org/configuring.html#database-pooling
host: <%= ENV.fetch("DB_HOST") { "localhost" } %>
port: <%= ENV.fetch("DB_PORT") { "5432" } %>
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 25 } %>
pool: <%= ENV.fetch("DB_POOL") { 5 } %>
username: <%= ENV.fetch("DB_USERNAME") { "postgres" } %>
password: <%= ENV.fetch("DB_PASSWORD") { "postgres" } %>
reaping_frequency: 60 # every 60s check pool
timeout: 5000 # over 5s will timeout
variables:
statement_timeout: 120000 # query timemout over 120s
idle_in_transaction_session_timeout: 60000 # idle transaction over 60s
statement_timeout: 60000 # query timemout over 60s
idle_in_transaction_session_timeout: 120000 # idle transaction over 120s

development:
<<: *default
Expand Down Expand Up @@ -88,5 +88,5 @@ test:
# url: <%= ENV['DATABASE_URL'] %>
#
production:
<<: *default
url: <%= ENV['DATABASE_URL'] %>
pool: <%= ENV["DB_POOL"] || ENV['RAILS_MAX_THREADS'] || 5 %>

0 comments on commit 1295066

Please sign in to comment.