From: Anton Khorev Date: Sat, 23 Mar 2024 18:02:48 +0000 (+0300) Subject: Timeout instantly if web_timeout setting is negative X-Git-Tag: live~208^2~2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/51e0cf85b0b44c32b0cb097e046eafed7f7f14be Timeout instantly if web_timeout setting is negative --- diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4b36607bb..8290a027e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -216,6 +216,8 @@ class ApplicationController < ActionController::Base ## # wrap a web page in a timeout def web_timeout(&block) + raise Timeout::Error if Settings.web_timeout.negative? + Timeout.timeout(Settings.web_timeout, &block) rescue ActionView::Template::Error => e e = e.cause