Fix worker crash: remove broken gunicorn post_fork hook
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+7
-3
@@ -2,6 +2,7 @@ import os
|
||||
|
||||
from flask import (
|
||||
Blueprint,
|
||||
Response,
|
||||
abort,
|
||||
current_app,
|
||||
flash,
|
||||
@@ -21,6 +22,7 @@ from app.models import Folder, Photo
|
||||
from app.settings_service import get_settings
|
||||
from app.storage_service import delete_photo_file, get_photo_stream
|
||||
from app.upload_service import process_uploads
|
||||
from sqlalchemy import text
|
||||
|
||||
bp = Blueprint("main", __name__)
|
||||
|
||||
@@ -28,10 +30,12 @@ bp = Blueprint("main", __name__)
|
||||
@bp.route("/health")
|
||||
def health():
|
||||
try:
|
||||
db.session.execute(db.text("SELECT 1"))
|
||||
return {"status": "ok"}, 200
|
||||
db.session.execute(text("SELECT 1"))
|
||||
db.session.remove()
|
||||
return Response("ok\n", mimetype="text/plain")
|
||||
except Exception as exc:
|
||||
return {"status": "error", "detail": str(exc)}, 503
|
||||
db.session.remove()
|
||||
return Response(f"error: {exc}\n", status=503, mimetype="text/plain")
|
||||
|
||||
|
||||
@bp.route("/")
|
||||
|
||||
Reference in New Issue
Block a user