Files
notifications-api/gunicorn_config.py

39 lines
990 B
Python
Raw Normal View History

2025-07-30 14:49:26 -07:00
# import logging
2025-07-15 14:03:08 -07:00
import os # noqa
import socket # noqa
import sys # noqa
import traceback # noqa
2025-07-30 10:53:03 -07:00
import gunicorn
from app.utils import hilite # noqa
2025-07-15 14:03:08 -07:00
2025-07-28 08:52:02 -07:00
# This will give us a better stack trace if
workers = 4
worker_class = "gevent"
worker_connections = 256
2025-07-30 14:49:26 -07:00
# logging.basicConfig(level=logging.INFO)
# timeout = 240
# logging.info(hilite(f"Gunicorn timeout set to {timeout} seconds"))
bind = "0.0.0.0:{}".format(os.getenv("PORT"))
statsd_host = "{}:8125".format(os.getenv("STATSD_HOST"))
2023-08-29 14:54:30 -07:00
gunicorn.SERVER_SOFTWARE = "None"
2017-09-22 15:34:43 +01:00
def on_starting(server):
server.log.info("Starting Notifications API")
def worker_abort(worker):
worker.log.info("worker received ABORT {}".format(worker.pid))
for _threadId, stack in sys._current_frames().items():
2023-08-29 14:54:30 -07:00
worker.log.error("".join(traceback.format_stack(stack)))
def on_exit(server):
server.log.info("Stopping Notifications API")
def worker_int(worker):
worker.log.info("worker: received SIGINT {}".format(worker.pid))