fixes #730
This commit is contained in:
@@ -13,7 +13,14 @@ class ApplicationController < ActionController::Base
|
|||||||
protected
|
protected
|
||||||
def rescue_exception(exception)
|
def rescue_exception(exception)
|
||||||
@exception = exception
|
@exception = exception
|
||||||
render :template => "static/error", :status => 500
|
|
||||||
|
if exception.is_a?(::ActiveRecord::StatementInvalid) && exception.to_s =~ /statement timeout/
|
||||||
|
@exception = nil
|
||||||
|
@error_message = "The database timed out running your query."
|
||||||
|
render :template => "static/error", :status => 500
|
||||||
|
else
|
||||||
|
render :template => "static/error", :status => 500
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def render_pagination_limit
|
def render_pagination_limit
|
||||||
|
|||||||
@@ -99,8 +99,7 @@ protected
|
|||||||
@error_message = "Meta-tags are not supported in comment searches by tag"
|
@error_message = "Meta-tags are not supported in comment searches by tag"
|
||||||
render :template => "static/error", :status => 500
|
render :template => "static/error", :status => 500
|
||||||
else
|
else
|
||||||
@exception = e
|
rescue_exception(e)
|
||||||
render :template => "static/error", :status => 500
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -12,13 +12,6 @@ class PostsController < ApplicationController
|
|||||||
respond_with(@posts) do |format|
|
respond_with(@posts) do |format|
|
||||||
format.atom
|
format.atom
|
||||||
end
|
end
|
||||||
rescue ::ActiveRecord::StatementInvalid => e
|
|
||||||
if e.to_s =~ /statement timeout/
|
|
||||||
@error_message = "The database timed out running your query. Try a simpler query that returns fewer results."
|
|
||||||
render :template => "static/error", :status => 500
|
|
||||||
else
|
|
||||||
raise
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ module PostSets
|
|||||||
end
|
end
|
||||||
|
|
||||||
@posts ||= begin
|
@posts ||= begin
|
||||||
temp = ::Post.with_timeout(500, nil) do
|
temp = ::Post.with_timeout(timeout, nil) do
|
||||||
::Post.tag_match(tag_string).paginate(page, :count => ::Post.fast_count(tag_string), :limit => per_page)
|
::Post.tag_match(tag_string).paginate(page, :count => ::Post.fast_count(tag_string), :limit => per_page)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user