import multiprocessing


def max_workers_and_threads() -> int:
    """
    Compute recommended number of gunicorn workers and threads.
    https://stackoverflow.com/questions/38425620/gunicorn-workers-and-threads
    :return: recommended number of gunicorn workers and threads.
    :rtype: int
    """

    return multiprocessing.cpu_count() * 2 + 1


HOST = "0.0.0.0"
PORT = 8080

bind = f"{HOST}:{PORT}"
workers = 1  # The number of worker processes for handling requests
threads = min(  # The number of worker threads for handling requests
    8, max_workers_and_threads()
)
timeout = 0  # Workers silent for more than this many seconds are killed and restarted

import multiprocessing


def max_workers_and_threads() -> int:
    """
    Compute recommended number of gunicorn workers and threads.
    https://stackoverflow.com/questions/38425620/gunicorn-workers-and-threads
    :return: recommended number of gunicorn workers and threads.
    :rtype: int
    """

    return multiprocessing.cpu_count() * 2 + 1


HOST = "0.0.0.0"
PORT = 8080

bind = f"{HOST}:{PORT}"
workers = 1  # The number of worker processes for handling requests
threads = min(  # The number of worker threads for handling requests
    8, max_workers_and_threads()
)
timeout = 0  # Workers silent for more than this many seconds are killed and restarted

Compute recommended number of gunicorn workers and threads.     https://stackoverflow.com/questions/38425620/gunicorn-workers-and-threads     :return: recommended number of gunicorn workers and threads.     :rtype: int # The number of worker processes for handling requests # The number of worker threads for handling requests # Workers silent for more than this many seconds are killed and restarted