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:44:15 +00:00
|
|
|
worker_count = 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):
|
2022-08-24 20:22:54 +00:00
|
|
|
worker.log.warning(f"Worker {worker.pid} received SIGABRT.")
|
|
|
|
try:
|
2022-11-17 16:34:30 +00:00
|
|
|
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}")
|
2022-11-17 16:34:30 +00:00
|
|
|
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}")
|
2022-11-17 16:34:30 +00:00
|
|
|
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)
|
2022-08-24 20:22:54 +00:00
|
|
|
else:
|
2022-11-17 16:34:30 +00:00
|
|
|
worker.log.warning("No request info")
|
2022-08-24 20:22:54 +00:00
|
|
|
except:
|
2022-11-17 16:34:30 +00:00
|
|
|
worker.log.warning("Failed to get request info")
|
2022-08-24 20:22:54 +00:00
|
|
|
|
2022-08-24 01:40:17 +00:00
|
|
|
import os
|
|
|
|
os.abort()
|