diff --git a/configs/development.ini b/configs/development.ini --- a/configs/development.ini +++ b/configs/development.ini @@ -579,6 +579,9 @@ svn.proxy.location_root = / ## Command to reload the mod dav svn configuration on change. ## Example: `/etc/init.d/apache2 reload` #svn.proxy.reload_cmd = /etc/init.d/apache2 reload +## If the timeout expires before the reload command finishes, the command will +## be killed. Setting it to zero means no timeout. Defaults to 10 seconds. +#svn.proxy.reload_timeout = 10 ################################ diff --git a/configs/production.ini b/configs/production.ini --- a/configs/production.ini +++ b/configs/production.ini @@ -550,6 +550,9 @@ svn.proxy.location_root = / ## Command to reload the mod dav svn configuration on change. ## Example: `/etc/init.d/apache2 reload` #svn.proxy.reload_cmd = /etc/init.d/apache2 reload +## If the timeout expires before the reload command finishes, the command will +## be killed. Setting it to zero means no timeout. Defaults to 10 seconds. +#svn.proxy.reload_timeout = 10 ################################ diff --git a/rhodecode/svn_support/__init__.py b/rhodecode/svn_support/__init__.py --- a/rhodecode/svn_support/__init__.py +++ b/rhodecode/svn_support/__init__.py @@ -24,7 +24,8 @@ import os # Do not use `from rhodecode import events` here, it will be overridden by the # events module in this package due to pythons import mechanism. from rhodecode.events import RepoGroupEvent -from rhodecode.config.middleware import _bool_setting, _string_setting +from rhodecode.config.middleware import ( + _bool_setting, _string_setting, _int_setting) from .events import ModDavSvnConfigChange from .subscribers import generate_config_subscriber, AsyncSubprocessSubscriber @@ -56,13 +57,17 @@ def _sanitize_settings_and_apply_default """ Set defaults, convert to python types and validate settings. """ - # Convert bool settings from string to bool. _bool_setting(settings, config_keys.generate_config, 'false') _bool_setting(settings, config_keys.list_parent_path, 'true') + _int_setting(settings, config_keys.reload_timeout, 10) _string_setting(settings, config_keys.config_file_path, '', lower=False) _string_setting(settings, config_keys.location_root, '/', lower=False) _string_setting(settings, config_keys.reload_command, '', lower=False) + # Convert negative timeout values to zero. + if settings[config_keys.reload_timeout] < 0: + settings[config_keys.reload_timeout] = 0 + # Append path separator to location root. settings[config_keys.location_root] = _append_path_sep( settings[config_keys.location_root]) diff --git a/rhodecode/svn_support/config_keys.py b/rhodecode/svn_support/config_keys.py --- a/rhodecode/svn_support/config_keys.py +++ b/rhodecode/svn_support/config_keys.py @@ -26,3 +26,4 @@ generate_config = 'svn.proxy.generate_co list_parent_path = 'svn.proxy.list_parent_path' location_root = 'svn.proxy.location_root' reload_command = 'svn.proxy.reload_cmd' +reload_timeout = 'svn.proxy.reload_timeout'