Add timeout and workers option for Gunicorn.

Add timeout and workers option for Gunicorn,
otherwise long request and multi request won't return.

Closes-Bug: #1652861
Change-Id: If289511c2c64ecb7c09ed14e7862174358052f30
Signed-off-by: Andy Yan <yanchao3@lenovo.com>
This commit is contained in:
Andy Yan 2016-12-27 15:26:16 +08:00
parent f1d66ce2b5
commit 965cb384a6
3 changed files with 11 additions and 1 deletions

View File

@ -13,6 +13,12 @@ log_file=/var/log/valence/valence.log
bind_host = 0.0.0.0
bind_port = 8181
#Server request timeout
timeout=1000
#Server workers
workers=4
[podm]
url=https://<ip address>:<port>
user=<podm user>

View File

@ -45,7 +45,9 @@ class StandaloneApplication(gunicorn.app.base.BaseApplication):
def main():
options = {
'bind': '%s:%s' % (cfg.bind_host, cfg.bind_port),
'reload': cfg.debug
'reload': cfg.debug,
'timeout': cfg.timeout,
'workers': cfg.workers
}
StandaloneApplication(application, options).run()
LOG.info(("Valence Server on http://%(host)s:%(port)s"),

View File

@ -61,6 +61,8 @@ log_format = get_option("DEFAULT", "log_format", log_default_format)
bind_port = get_option("DEFAULT", "bind_port", 8181, int)
bind_host = get_option("DEFAULT", "bind_host", "0.0.0.0")
debug = get_option("DEFAULT", "debug", False, bool)
timeout = get_option("DEFAULT", "timeout", 1000, int)
workers = get_option("DEFAULT", "workers", 4, int)
# PODM Settings
podm_url = get_option("podm", "url", "http://127.0.0.1")