svn-support: Make the reload command timeout configurable via ini file.

Duration of the reload command may heavily vary between different
commands, setups, etc. Therefore we should make the timeout
configurable. This way customers can adapt it to their needs.
This commit is contained in:
Martin Bornhold 2016-10-14 15:40:48 +02:00
parent 30f00dc9fd
commit 2a2581e7b3
4 changed files with 14 additions and 2 deletions

View file

@ -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
################################

View file

@ -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
################################

View file

@ -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_defaults(settings):
"""
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])

View file

@ -26,3 +26,4 @@ generate_config = 'svn.proxy.generate_config'
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'