FIX: ensures reports can't modify records (#8006)

This commit is contained in:
Joffrey JAFFEUX 2019-08-15 09:27:53 +02:00 committed by Sam
parent 50368940f7
commit 0a6d1b687c
1 changed files with 2 additions and 0 deletions

View File

@ -83,6 +83,8 @@ class Report
def self.wrap_slow_query(timeout = 20000)
ActiveRecord::Base.connection.transaction do
# Allows only read only transactions
DB.exec "SET TRANSACTION READ ONLY"
# Set a statement timeout so we can't tie up the server
DB.exec "SET LOCAL statement_timeout = #{timeout}"
yield