users: set archives DB timeout on profile pages.
Fixes profile pages potentially hanging for 60+ seconds if the archives database is slow to respond.
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
class UsersController < ApplicationController
|
||||
respond_to :html, :xml, :json
|
||||
|
||||
around_action :set_timeout, only: [:profile, :show]
|
||||
|
||||
rate_limit :create, rate: 1.0/5.minutes, burst: 10
|
||||
|
||||
def new
|
||||
@@ -119,6 +121,13 @@ class UsersController < ApplicationController
|
||||
|
||||
private
|
||||
|
||||
def set_timeout
|
||||
PostVersion.connection.execute("SET statement_timeout = #{CurrentUser.user.statement_timeout}")
|
||||
yield
|
||||
ensure
|
||||
PostVersion.connection.execute("SET statement_timeout = 0")
|
||||
end
|
||||
|
||||
def item_matches_params(user)
|
||||
if params[:search][:name_matches]
|
||||
User.normalize_name(user.name) == User.normalize_name(params[:search][:name_matches])
|
||||
|
||||
Reference in New Issue
Block a user