Skip to content

Instantly share code, notes, and snippets.

@rud
Created January 24, 2016 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rud/180a91e9ced34e5e3bbb to your computer and use it in GitHub Desktop.
Save rud/180a91e9ced34e5e3bbb to your computer and use it in GitHub Desktop.
ActiveRecord::Base - set short timeouts for production queries, nothing end-users do should be taking this long
# Do not suffer slow queries in production:
aggressive_timeout_settings: &aggressive_timeout_settings
adapter: postgresql
encoding: unicode
connect_timeout: 1 # second - network handshake time
checkout_timeout: 1 # second - connection pool checkout wait time
variables:
statement_timeout: 2500 # ms - maximum time for a single SQL query
production:
<<: *aggressive_timeout_settings
username: ..
database: ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment