From d4d541747ec6f2c21e76ffe95707fd360422322a Mon Sep 17 00:00:00 2001 From: Kane York Date: Mon, 14 Sep 2015 16:07:41 -0700 Subject: [PATCH] Add a statement timeout so you can't tie up the serve --- plugin.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin.rb b/plugin.rb index 188be53..e9b08ad 100644 --- a/plugin.rb +++ b/plugin.rb @@ -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