##// END OF EJS Templates
gunicorn: updated config template with better compatability with configparser
marcink -
r4167:a57c25da default
parent child Browse files
Show More
@@ -66,7 +66,7 b' def _get_config(ini_path):'
66 66 except ImportError:
67 67 import ConfigParser as configparser
68 68 try:
69 config = configparser.ConfigParser()
69 config = configparser.RawConfigParser()
70 70 config.read(ini_path)
71 71 return config
72 72 except Exception:
@@ -90,15 +90,18 b' def post_fork(server, worker):'
90 90
91 91 ini_path = os.path.abspath(server.cfg.paste)
92 92 conf = _get_config(ini_path)
93 if conf and 'server:main' in conf:
94 section = conf['server:main']
93
94 section = 'server:main'
95 if conf and conf.has_section(section):
95 96
96 if section.get('memory_max_usage'):
97 _memory_max_usage = int(section.get('memory_max_usage'))
98 if section.get('memory_usage_check_interval'):
99 _memory_usage_check_interval = int(section.get('memory_usage_check_interval'))
100 if section.get('memory_usage_recovery_threshold'):
101 _memory_usage_recovery_threshold = float(section.get('memory_usage_recovery_threshold'))
97 if conf.has_option(section, 'memory_max_usage'):
98 _memory_max_usage = conf.getint(section, 'memory_max_usage')
99
100 if conf.has_option(section, 'memory_usage_check_interval'):
101 _memory_usage_check_interval = conf.getint(section, 'memory_usage_check_interval')
102
103 if conf.has_option(section, 'memory_usage_recovery_threshold'):
104 _memory_usage_recovery_threshold = conf.getfloat(section, 'memory_usage_recovery_threshold')
102 105
103 106 worker._memory_max_usage = _memory_max_usage
104 107 worker._memory_usage_check_interval = _memory_usage_check_interval
General Comments 0
You need to be logged in to leave comments. Login now