Skip to content

A platform for community discussion. Free, open, simple.

FIX: global setting needs to be coerced to float (#11162)

Sam94cd5ac0b1b6
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index c909fc09145..be26e2724bb 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -173,9 +173,13 @@ class SearchController < ApplicationController
protected
def site_overloaded?
- (queue_time = request.env['REQUEST_QUEUE_SECONDS']) &&
- (GlobalSetting.disable_search_queue_threshold > 0) &&
- (queue_time > GlobalSetting.disable_search_queue_threshold)
+ queue_time = request.env['REQUEST_QUEUE_SECONDS']
+ if queue_time
+ threshold = GlobalSetting.disable_search_queue_threshold.to_f
+ threshold > 0 && queue_time > threshold
+ else
+ false
+ end
end
def rate_limit_search