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
|
|
||||||
u = get_logged_in_user()
|
|
||||||
if u:
|
if u:
|
||||||
worker.log.warning(f"User: {u.username!r} id:{u.id}")
|
worker.log.warning(f"User: {u.username!r} id:{u.id}")
|
||||||
else:
|
else:
|
||||||
worker.log.warning(f"User: not logged in")
|
worker.log.warning(f"User: not logged in")
|
||||||
except:
|
else:
|
||||||
worker.log.warning("No request info")
|
worker.log.warning("No request info")
|
||||||
|
except:
|
||||||
|
worker.log.warning("Failed to get request info")
|
||||||
|
|
||||||
import os
|
import os
|
||||||
os.abort()
|
os.abort()
|
||||||
|
|
Loading…
Reference in New Issue