search: refactor fast_count to return nil on timeout.
* Refactor fast_count to return nil instead of 1,000,000 if the exact count times out. * Remove the estimate_post_counts and blank_tag_search_fast_count global config options. * Replace the hardcoded post count estimates inside fast_count with a method that parses Postgres's estimated row count from EXPLAIN. * /counts/posts.json: ** Remove the `raise_on_timeout` parameter. ** Add an `estimate_count=<true|false>` parameter. ** Return null instead of 1,000,000 if the exact count times out.
This commit is contained in:
@@ -299,13 +299,6 @@ module Danbooru
|
||||
[]
|
||||
end
|
||||
|
||||
# Counting every post is typically expensive because it involves a sequential scan on
|
||||
# potentially millions of rows. If this method returns a value, then blank searches
|
||||
# will return that number for the fast_count call instead.
|
||||
def blank_tag_search_fast_count
|
||||
nil
|
||||
end
|
||||
|
||||
# DeviantArt login cookies. Login to DeviantArt and extract these from the browser.
|
||||
# https://github.com/danbooru/danbooru/issues/4219
|
||||
def deviantart_cookies
|
||||
@@ -440,11 +433,6 @@ module Danbooru
|
||||
false
|
||||
end
|
||||
|
||||
# enable some (donmai-specific) optimizations for post counts
|
||||
def estimate_post_counts
|
||||
false
|
||||
end
|
||||
|
||||
# Enables recording of popular searches, missed searches, and post view
|
||||
# counts. Requires Reportbooru to be configured and running - see below.
|
||||
def enable_post_search_counts
|
||||
|
||||
Reference in New Issue
Block a user