From 51e0cf85b0b44c32b0cb097e046eafed7f7f14be Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sat, 23 Mar 2024 21:02:48 +0300 Subject: [PATCH] Timeout instantly if web_timeout setting is negative --- app/controllers/application_controller.rb | 2 ++ 1 file changed, 2 insertions(+) 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 -- 2.39.5