throw error on counts/posts endpoint during a timeout (#2170)

This commit is contained in:
Albert Yi
2018-09-19 13:34:50 -07:00
parent 2f17082e73
commit ed5b2ad443
3 changed files with 13 additions and 1 deletions

View File

@@ -1,7 +1,8 @@
class CountsController < ApplicationController
respond_to :xml, :json
rescue_from Post::TimeoutError, with: :rescue_exception
def posts
@count = Post.fast_count(params[:tags])
@count = Post.fast_count(params[:tags], raise_on_timeout: true)
end
end