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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Move rack_timeout in reloader
Oliver Günthere5358ea5aff1
diff --git a/config/initializers/rack_timeout.rb b/config/initializers/rack_timeout.rbindex 27e48f0744d..947c035b2fd 100644--- a/config/initializers/rack_timeout.rb+++ b/config/initializers/rack_timeout.rb@@ -14,30 +14,32 @@ if OpenProject::Configuration.web_workers >= 2term_on_timeout: 1 # shut down worker (gracefully) right away on timeout to be restarted)- # remove default logger (logging uninteresting extra info with each not timed out request)- Rack::Timeout.unregister_state_change_observer(:logger)+ Rails.application.reloader.to_prepare do+ # remove default logger (logging uninteresting extra info with each not timed out request)+ Rack::Timeout.unregister_state_change_observer(:logger)- Rack::Timeout.register_state_change_observer(:wait_timeout_logger) do |env|- details = env[Rack::Timeout::ENV_INFO_KEY]+ Rack::Timeout.register_state_change_observer(:wait_timeout_logger) do |env|+ details = env[Rack::Timeout::ENV_INFO_KEY]- if details.state == :timed_out && details.wait.present?- ::OpenProject.logger.error "Request timed out waiting to be served!"+ if details.state == :timed_out && details.wait.present?+ ::OpenProject.logger.error "Request timed out waiting to be served!"+ endend- end- # The timeout itself is already reported so no need to- # report the generic internal server error too as it doesn't- # add any more information. Even worse, it's not immediately- # clear that the two reports are related.- module SuppressInternalErrorReportOnTimeout- def op_handle_error(message_or_exception, context = {})- return if request && request.env[Rack::Timeout::ENV_INFO_KEY].try(:state) == :timed_out+ # The timeout itself is already reported so no need to+ # report the generic internal server error too as it doesn't+ # add any more information. Even worse, it's not immediately+ # clear that the two reports are related.+ module SuppressInternalErrorReportOnTimeout+ def op_handle_error(message_or_exception, context = {})+ return if request && request.env[Rack::Timeout::ENV_INFO_KEY].try(:state) == :timed_out- super+ super+ endend- end- OpenProjectErrorHelper.prepend SuppressInternalErrorReportOnTimeout+ OpenProjectErrorHelper.prepend SuppressInternalErrorReportOnTimeout+ endelseRails.logger.debug { "Not enabling Rack::Timeout since we are not running in cluster mode with at least 2 workers" }end