forked from MarseyWorld/MarseyWorld
workers: simplify error handler
this prevents a relatively rare query to db still it makes me feel better, especially when we have only a little bit of time anywaymaster
parent
f4ad331d23
commit
8d46295d49
|
@ -8,23 +8,22 @@ max_requests_jitter = 30000
|
||||||
|
|
||||||
reload = True
|
reload = True
|
||||||
reload_engine = 'poll'
|
reload_engine = 'poll'
|
||||||
#print_config = True
|
|
||||||
|
|
||||||
def worker_abort(worker):
|
def worker_abort(worker):
|
||||||
worker.log.warning(f"Worker {worker.pid} received SIGABRT.")
|
worker.log.warning(f"Worker {worker.pid} received SIGABRT.")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import flask
|
from flask import g, request
|
||||||
r = flask.request
|
if g and request:
|
||||||
worker.log.warning(f"While serving {r.method} {r.url}")
|
u = getattr(g, 'v', None)
|
||||||
from files.routes.wrappers import get_logged_in_user
|
if u:
|
||||||
u = get_logged_in_user()
|
worker.log.warning(f"User: {u.username!r} id:{u.id}")
|
||||||
if u:
|
else:
|
||||||
worker.log.warning(f"User: {u.username!r} id:{u.id}")
|
worker.log.warning(f"User: not logged in")
|
||||||
else:
|
else:
|
||||||
worker.log.warning(f"User: not logged in")
|
worker.log.warning("No request info")
|
||||||
except:
|
except:
|
||||||
worker.log.warning("No request info")
|
worker.log.warning("Failed to get request info")
|
||||||
|
|
||||||
import os
|
import os
|
||||||
os.abort()
|
os.abort()
|
||||||
|
|
Loading…
Reference in New Issue