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

refactor: make it consistent with other WEB settings

Christophe Bliard30129450adbc
diff --git a/config/initializers/rack_timeout.rb b/config/initializers/rack_timeout.rb
index 40095d346b8..27e48f0744d 100644
--- a/config/initializers/rack_timeout.rb
+++ b/config/initializers/rack_timeout.rb
@@ -1,15 +1,15 @@
# Use rack-timeout if we run in clustered mode with at least 2 workers
# so that workers, should a timeout occur, can be restarted without interruption.
if OpenProject::Configuration.web_workers >= 2
- timeout = Integer(ENV['RACK_TIMEOUT_SERVICE_TIMEOUT'].presence || OpenProject::Configuration.web_timeout)
- wait_timeout = Integer(ENV['RACK_TIMEOUT_WAIT_TIMEOUT'].presence || OpenProject::Configuration.web_wait_timeout)
+ service_timeout = OpenProject::Configuration.web_timeout
+ wait_timeout = OpenProject::Configuration.web_wait_timeout
- Rails.logger.debug { "Enabling Rack::Timeout (service=#{timeout}s wait=#{wait_timeout}s)" }
+ Rails.logger.debug { "Enabling Rack::Timeout (service=#{service_timeout}s wait=#{wait_timeout}s)" }
Rails.application.config.middleware.insert_before(
::Rack::Runtime,
::Rack::Timeout,
- service_timeout: timeout, # time after which a request being served times out
+ service_timeout: service_timeout, # time after which a request being served times out
wait_timeout: 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
)
diff --git a/lib/open_project/configuration/helpers.rb b/lib/open_project/configuration/helpers.rb
index 859b35d5e8f..d1218d30fad 100644
--- a/lib/open_project/configuration/helpers.rb
+++ b/lib/open_project/configuration/helpers.rb
@@ -161,11 +161,11 @@ module OpenProject
end
def web_timeout
- Integer(web['timeout'].presence)
+ Integer(ENV['RACK_TIMEOUT_SERVICE_TIMEOUT'].presence || web['timeout'].presence)
end
def web_wait_timeout
- Integer(web['wait_timeout'].presence)
+ Integer(ENV['RACK_TIMEOUT_WAIT_TIMEOUT'].presence || web['wait_timeout'].presence)
end
def web_min_threads