trap on statement timeouts when counting posts

This commit is contained in:
albert
2013-01-06 13:25:08 -05:00
parent 6a2f80619d
commit 2a83f2d0ca

View File

@@ -73,6 +73,12 @@ module Danbooru
c = c.reorder(nil)
c = c.count
c.respond_to?(:count) ? c.count : c
rescue ActiveRecord::StatementInvalid => e
if e.to_s =~ /statement timeout/
1_000_000
else
raise
end
end
end
end