2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-24 15:38:25 +00:00

add config option for http timeout

This commit is contained in:
Pratik Vyas 2014-09-04 15:35:23 +05:30
parent 0e30ec02f0
commit 725dced1c3
4 changed files with 12 additions and 2 deletions

View File

@ -294,11 +294,18 @@ def config_rebase_on_pull(state):
state = True if state == 'on' else False state = True if state == 'on' else False
update_config({'rebase_on_pull': state}) update_config({'rebase_on_pull': state})
@click.command('http_timeout')
@click.argument('seconds', type=int)
def config_http_timeout(seconds):
"set http timeout"
update_config({'http_timeout': seconds})
config.add_command(config_auto_update) config.add_command(config_auto_update)
config.add_command(config_update_bench_on_update) config.add_command(config_update_bench_on_update)
config.add_command(config_restart_supervisor_on_update) config.add_command(config_restart_supervisor_on_update)
config.add_command(config_dns_multitenant) config.add_command(config_dns_multitenant)
config.add_command(config_serve_default_site) config.add_command(config_serve_default_site)
config.add_command(config_http_timeout)
#Bench commands #Bench commands

View File

@ -12,11 +12,13 @@ def generate_supervisor_config(bench='.'):
sites_dir = os.path.join(bench_dir, "sites") sites_dir = os.path.join(bench_dir, "sites")
sites = get_sites(bench=bench) sites = get_sites(bench=bench)
user = getpass.getuser() user = getpass.getuser()
config = get_config()
config = template.render(**{ config = template.render(**{
"bench_dir": bench_dir, "bench_dir": bench_dir,
"sites_dir": sites_dir, "sites_dir": sites_dir,
"user": user, "user": user,
"http_timeout": config.get("http_timeout", 120),
}) })
with open("config/supervisor.conf", 'w') as f: with open("config/supervisor.conf", 'w') as f:
f.write(config) f.write(config)
@ -50,6 +52,7 @@ def generate_nginx_config(bench='.'):
config = template.render(**{ config = template.render(**{
"sites_dir": sites_dir, "sites_dir": sites_dir,
"http_timeout": get_config().get("http_timeout", 120),
"default_site": default_site, "default_site": default_site,
"dns_multitenant": get_config().get('dns_multitenant'), "dns_multitenant": get_config().get('dns_multitenant'),
"sites": sites "sites": sites

View File

@ -35,7 +35,7 @@ upstream frappe {
proxy_set_header Host {{ site.name }}; proxy_set_header Host {{ site.name }};
{% endif %} {% endif %}
proxy_set_header X-Use-X-Accel-Redirect True; proxy_set_header X-Use-X-Accel-Redirect True;
proxy_read_timeout 120; proxy_read_timeout {{http_timeout}};
proxy_redirect off; proxy_redirect off;
proxy_pass http://frappe; proxy_pass http://frappe;
} }

View File

@ -1,5 +1,5 @@
[program:frappe-web] [program:frappe-web]
command={{ bench_dir }}/env/bin/gunicorn -b 127.0.0.1:8000 -w 2 -t 120 frappe.app:application command={{ bench_dir }}/env/bin/gunicorn -b 127.0.0.1:8000 -w 2 -t {{http_timeout}} frappe.app:application
autostart=true autostart=true
autorestart=true autorestart=true
stopsignal=QUIT stopsignal=QUIT