MarseyWorld/gunicorn.conf.py

36 lines
1.1 KiB
Python
Raw Normal View History

2023-07-30 01:44:15 +00:00
from os import environ
2023-07-18 08:40:50 +00:00
STARS = '\n\n★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★\n\n'
2023-03-06 20:49:01 +00:00
2022-08-24 01:40:17 +00:00
bind = '0.0.0.0:5000'
worker_class = 'gevent'
2023-07-30 01:46:56 +00:00
workers = int(environ.get("WORKER_COUNT").strip())
2022-08-24 01:40:17 +00:00
2023-06-23 08:07:23 +00:00
max_requests = 5000
2023-03-22 16:32:23 +00:00
max_requests_jitter = 10000
2022-08-24 01:40:17 +00:00
reload = True
2022-09-27 06:02:02 +00:00
reload_engine = 'poll'
2022-08-24 01:40:17 +00:00
def worker_abort(worker):
worker.log.warning(f"Worker {worker.pid} received SIGABRT.")
try:
from flask import g, request
if g and request:
2023-03-06 20:49:01 +00:00
worker.log.warning(STARS)
2022-12-25 04:36:08 +00:00
worker.log.warning(f"While serving {request.method} {request.url}")
u = getattr(g, 'v', None)
if u:
2022-12-25 04:36:08 +00:00
worker.log.warning(f"User: {u.username!r} id:{u.id}")
else:
2022-12-25 04:36:08 +00:00
worker.log.warning(f"User: not logged in")
2023-03-06 20:49:01 +00:00
worker.log.warning(STARS)
else:
worker.log.warning("No request info")
except:
worker.log.warning("Failed to get request info")
2022-08-24 01:40:17 +00:00
import os
os.abort()