"""
gunicorn configuration file: http://docs.gunicorn.org/en/develop/configure.html

{{ ansible_managed }}
"""
import multiprocessing

preload_app = True
timeout = {{ edx_notes_api_gunicorn_timeout }}
bind = "{{ edx_notes_api_gunicorn_host }}:{{ edx_notes_api_gunicorn_port }}"
pythonpath = "{{ edx_notes_api_code_dir }}"

{% if EDX_NOTES_API_WORKERS %}
workers = {{ EDX_NOTES_API_WORKERS }}
{% else %}
workers = (multiprocessing.cpu_count()-1) * 2 + 2
{% endif %}

{{ common_close_all_caches }}

def post_fork(server, worker):
    close_all_caches()

{{ EDX_NOTES_API_WORKERS_EXTRA_CONF }}
