Add a statement timeout so you can't tie up the serve

This commit is contained in:
Kane York 2015-09-14 16:07:41 -07:00
parent 4b3188c111
commit d4d541747e
1 changed files with 2 additions and 0 deletions

View File

@ -90,6 +90,8 @@ after_initialize do
# Setting transaction to read only prevents shoot-in-foot actions like SELECT FOR UPDATE
# see test 'doesn't allow you to modify the database #1'
ActiveRecord::Base.exec_sql "SET TRANSACTION READ ONLY"
# Set a statement timeout so we can't tie up the server
ActiveRecord::Base.exec_sql "SET LOCAL statement_timeout = 10000"
# SQL comments are for the benefits of the slow queries log
sql = <<-SQL