mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 09:42:36 +02:00
latest attempt to fix search timeout bug
This commit is contained in:
parent
92902696ab
commit
f3a2116b6e
1 changed files with 4 additions and 5 deletions
|
@ -120,10 +120,8 @@ def browse_sites_dataset
|
||||||
end
|
end
|
||||||
|
|
||||||
def daily_search_max?
|
def daily_search_max?
|
||||||
query_count = $redis_cache.get("search_query_count").to_i
|
query_count = $redis_cache.get('search_query_count').to_i
|
||||||
$redis_cache.expire("search_query_count", 86400) if query_count == 0
|
query_count >= $config['google_custom_search_query_limit']
|
||||||
return true if query_count >= $config['google_custom_search_query_limit']
|
|
||||||
false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/browse/search' do
|
get '/browse/search' do
|
||||||
|
@ -136,7 +134,8 @@ get '/browse/search' do
|
||||||
end
|
end
|
||||||
|
|
||||||
if !params[:q].blank?
|
if !params[:q].blank?
|
||||||
$redis_cache.incr("search_query_count")
|
created = $redis_cache.set('search_query_count', 1, nx: true, ex: 86400)
|
||||||
|
$redis_cache.incr('search_query_count') unless created
|
||||||
|
|
||||||
@start = params[:start].to_i
|
@start = params[:start].to_i
|
||||||
@start = 0 if @start < 0
|
@start = 0 if @start < 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue