post/pool versions: fix database timeouts not being set.
Bug: database timeouts were set only on the main database, not on the post and pool versions database, so users effectively had an unlimited timeout when dealing with these things.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
class PoolVersionsController < ApplicationController
|
||||
respond_to :html, :xml, :json
|
||||
before_action :check_availabililty
|
||||
around_action :set_timeout
|
||||
|
||||
def index
|
||||
if params[:search] && params[:search][:pool_id].present?
|
||||
@@ -23,6 +24,13 @@ class PoolVersionsController < ApplicationController
|
||||
|
||||
private
|
||||
|
||||
def set_timeout
|
||||
PoolArchive.connection.execute("SET statement_timeout = #{CurrentUser.user.statement_timeout}")
|
||||
yield
|
||||
ensure
|
||||
PoolArchive.connection.execute("SET statement_timeout = 0")
|
||||
end
|
||||
|
||||
def check_availabililty
|
||||
if !PoolArchive.enabled?
|
||||
raise NotImplementedError.new("Archive service is not configured. Pool versions are not saved.")
|
||||
|
||||
Reference in New Issue
Block a user