restrict count timeout to 500 ms
This commit is contained in:
@@ -601,9 +601,12 @@ class Post < ActiveRecord::Base
|
|||||||
count = Danbooru.config.blank_tag_search_fast_count
|
count = Danbooru.config.blank_tag_search_fast_count
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
ActiveRecord::Base.connection.execute("SET statement_timeout = 500")
|
||||||
count = Post.tag_match(tags).undeleted.count
|
count = Post.tag_match(tags).undeleted.count
|
||||||
rescue ActiveRecord::StatementInvalid
|
rescue ActiveRecord::StatementInvalid
|
||||||
count = Danbooru.config.blank_tag_search_fast_count || 1_000_000
|
count = Danbooru.config.blank_tag_search_fast_count || 1_000_000
|
||||||
|
ensure
|
||||||
|
ActiveRecord::Base.connection.execute("SET statement_timeout = 3000")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user