Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Make term_on_timeout configurable

Oliver Güntherda6fe7c01283
diff --git a/config/constants/settings/definition.rb b/config/constants/settings/definition.rb
index 9da4db2930c..0af9106415d 100644
--- a/config/constants/settings/definition.rb
+++ b/config/constants/settings/definition.rb
@@ -1166,7 +1166,8 @@ module Settings
"timeout" => Rails.env.production? ? 120 : 0,
"wait_timeout" => 30,
"min_threads" => 4,
- "max_threads" => 16
+ "max_threads" => 16,
+ "term_on_timeout" => 1
},
writable: false
},
diff --git a/config/initializers/rack_timeout.rb b/config/initializers/rack_timeout.rb
index 3e48bb80db1..0189af3e802 100644
--- a/config/initializers/rack_timeout.rb
+++ b/config/initializers/rack_timeout.rb
@@ -3,6 +3,7 @@
if OpenProject::Configuration.web_workers >= 2
service_timeout = OpenProject::Configuration.web_timeout
wait_timeout = OpenProject::Configuration.web_wait_timeout
+ term_on_timeout = OpenProject::Configuration.term_on_timeout
Rails.logger.debug { "Enabling Rack::Timeout (service=#{service_timeout}s wait=#{wait_timeout}s)" }
@@ -11,7 +12,7 @@ if OpenProject::Configuration.web_workers >= 2
Rack::Timeout,
service_timeout:, # time after which a request being served times out
wait_timeout:, # time after which a request waiting to be served times out
- term_on_timeout: 1, # shut down worker (gracefully) right away on timeout to be restarted
+ term_on_timeout:, # shut down worker (gracefully) right away on timeout to be restarted
service_past_wait: true # Treat the service timeout as independent from the wait timeout
)
diff --git a/lib_static/open_project/configuration/helpers.rb b/lib_static/open_project/configuration/helpers.rb
index 64ddcfbbcde..2979850f43f 100644
--- a/lib_static/open_project/configuration/helpers.rb
+++ b/lib_static/open_project/configuration/helpers.rb
@@ -182,6 +182,10 @@ module OpenProject
Integer(ENV["RACK_TIMEOUT_WAIT_TIMEOUT"].presence || web["wait_timeout"].presence)
end
+ def term_on_timeout
+ Integer(ENV["RACK_TIMEOUT_TERM_ON_TIMEOUT"].presence || web["term_on_timeout"].presence)
+ end
+
def web_min_threads
Integer(ENV["RAILS_MIN_THREADS"].presence || web["min_threads"].presence)
end