##// 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 except ImportError:
66 except ImportError:
67 import ConfigParser as configparser
67 import ConfigParser as configparser
68 try:
68 try:
69 config = configparser.ConfigParser()
69 config = configparser.RawConfigParser()
70 config.read(ini_path)
70 config.read(ini_path)
71 return config
71 return config
72 except Exception:
72 except Exception:
@@ -90,15 +90,18 b' def post_fork(server, worker):'
90
90
91 ini_path = os.path.abspath(server.cfg.paste)
91 ini_path = os.path.abspath(server.cfg.paste)
92 conf = _get_config(ini_path)
92 conf = _get_config(ini_path)
93 if conf and 'server:main' in conf:
93
94 section = conf['server:main']
94 section = 'server:main'
95 if conf and conf.has_section(section):
95
96
96 if section.get('memory_max_usage'):
97 if conf.has_option(section, 'memory_max_usage'):
97 _memory_max_usage = int(section.get('memory_max_usage'))
98 _memory_max_usage = conf.getint(section, 'memory_max_usage')
98 if section.get('memory_usage_check_interval'):
99
99 _memory_usage_check_interval = int(section.get('memory_usage_check_interval'))
100 if conf.has_option(section, 'memory_usage_check_interval'):
100 if section.get('memory_usage_recovery_threshold'):
101 _memory_usage_check_interval = conf.getint(section, 'memory_usage_check_interval')
101 _memory_usage_recovery_threshold = float(section.get('memory_usage_recovery_threshold'))
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 worker._memory_max_usage = _memory_max_usage
106 worker._memory_max_usage = _memory_max_usage
104 worker._memory_usage_check_interval = _memory_usage_check_interval
107 worker._memory_usage_check_interval = _memory_usage_check_interval
General Comments 0
You need to be logged in to leave comments. Login now